Content Management and Capture

Content Management and Capture

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
Expand all | Collapse all

Fetching Document ID in ICN Plugin function ecm.model.Action.performAction

  • 1.  Fetching Document ID in ICN Plugin function ecm.model.Action.performAction

    Posted Fri June 03, 2022 03:39 PM

    Hi,

    Requirement: I have folder search to retrieve the folder objects. Each folder might contain one or more documents. There are couple of actions the user can do on the documents. One of them is Delete. Upon Delete would like to insert audit record in to the custom table. Hence I would like to fetch either document property values or document id.

    What I have tried so far: Since I do not know how to fetch properties I am trying to fetch the selected document id using below code. so that I call service and do the audit.

    aspect.after(ecm.model.Action.prototype, "performAction", function(repository, itemList, callback, teamspace, resultSet, parameterMap) {

    var items = [], i;

    // Get real items if favorites

    if (itemList && itemList[0] && itemList[0].isInstanceOf && itemList[0].isInstanceOf(ecm.model.Favorite) && this.id != "RenameFavorite" && this.id != "EnableSync" && this.id != "DisableSync" && this.id != "DeleteFavorite" && this.id != "OpenFolder") {

    for (i in itemList) {

    items.push(itemList[i].item);

    }

    } else {

    items = itemList;

    }

    // Now show your id

    if (items && items.length > 0) {

    alert('Doc id::'+itemList[0].id);

    }

    });

    Output: The alert always showing repository name instead of document id.

    Could you please help me.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 2.  RE: Fetching Document ID in ICN Plugin function ecm.model.Action.performAction

    Posted Tue June 07, 2022 04:41 PM

    Devs reviewed your code and it did not appear sound. They advised that you should use a request / response filter to try and manage the desired outcome. You can use the original request to then design a response on the delete action.

    https://www.ibm.com/docs/en/content-navigator/3.0.x?topic=components-creating-request-response-filter

    This is challenging, though.

    Is this a CPE repository where the relevant content is stored? If so, CPE has native auditing functionality.



    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration


  • 3.  RE: Fetching Document ID in ICN Plugin function ecm.model.Action.performAction

    Posted Thu June 09, 2022 11:14 AM

    Hi,

    Thank you for your reply. One of my requirement is to not allow Delete action if one of the document property value is true. Hope that is possible with request/response filter.

    This is a CPE repository. Will also try to enable native auditing functionality.




    #IBMContentNavigator(ICN)
    #Support
    #SupportMigration