BPM, Workflow, and Case

BPM, Workflow, and Case

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

 View Only
  • 1.  Get Document ID for document explorer

    Posted Thu March 14, 2024 07:35 AM

    Hello,

    I am working on a process in IBM BAW, I have a coach with a document explorer view.

    I need to get the ID of the document when it's uploaded in the document explorer, and then store it in a variable. so that I can use is in a script in the next process step.

    any insights how I get the uploaded document ID ?

    Thanks,

    Kind regards.



    ------------------------------
    Amina SAHLAOUI
    ------------------------------


  • 2.  RE: Get Document ID for document explorer

    Posted Fri March 15, 2024 04:25 AM

    Hello Amina,

    If you use Document Explorer, you'll have ID folder from which you can retrieve documents. You can utilize the Content Integration Task (Operation: Get Documents in Folder) to gather all documents within this folder. This will provide you with a list of ECM Documents. From there, you can access the properties of each document, including its ID.

    I hope this helps!



    ------------------------------
    El Mehdi ES-SAFI
    ------------------------------



  • 3.  RE: Get Document ID for document explorer

    Posted Fri March 15, 2024 05:50 AM

    The Document Explorer coachview has an event for On document upload complete which passes back a variable named documentId (you can see this by hovering over the event name's text). To quickly verify I added the following to the event logic:

    console.log("documentId", documentId);

    After testing it out and proving that it works and printing the uploaded document's ID to the browser console, one technique you could use would be:

    1. Create a variable named documentId of type String in your client-side human service (CSHS).
    2. In the palette of your coach, add a Data control and bind it to the documentId variable. Also note the Control ID of this Data element, i.e. "Data1".
    3. Change the logic in On document upload complete event for the Document Explorer control to this:
      ${Data1}.setData(documentId);
    4. Now your CSHS variable documentId has the value of the uploaded document's ID.


    ------------------------------
    Don Williams
    ------------------------------



  • 4.  RE: Get Document ID for document explorer

    Posted Fri March 15, 2024 07:48 AM

    Hi William;

    your technique works great, 

    I used ${VarDocId}.setText(documentId) in the upload event. Then, in my script, I overwrote it with "{"+tw.local.VarDocId.slice(4)+"}" to remove the "idd_" from the returned string and obtain the exact ID value.

    Thenk you for your help.



    ------------------------------
    Amina SAHLAOUI
    ------------------------------



  • 5.  RE: Get Document ID for document explorer

    Posted Fri March 15, 2024 12:07 PM
    Edited by DAVE PERMAN Fri March 15, 2024 12:09 PM

    You all beat me to it! Great job community!

    As a recap for others, there are three ways that you usually get things from UI Views:

    1) binding - this is when the data to view connection is pretty obvious like a string variable and a text UI View to see/edit it - this is the one-to-one approach

    2) UI View Public JavaScript methods - this is common when the UI Views are more complex and in addition to being able to control various aspects of a view's UI, they can also be used to get set data associated with the view

    3) events - most views do (should) expose events so sneaky developers like you all can hook in and do more interesting things when something happens to the view. As shown in this thread, an easy approach is to just add a console (or my favourite - debugger; ) to the event and see what you get passed.

    One note on the document ID, you see it has a prefix that is used by CMIS to identify the objects type. If you are going to make any direct FIleNet API calls, just strip that off and pair your GUID with the FIleNet object store ID where the doc lives.



    ------------------------------
    DAVE PERMAN
    ------------------------------