BPM, Workflow, and Case

 View Only
  • 1.  BPM Document Upload

    Posted Thu December 16, 2021 11:42 AM
    Team,

    I have a requirement to upload CSV file and show it in UI table. My thought process to upload the document via OOTB document upload control to BPM Content store and Using Content Integration Palate Item retrieve the content Stream by passing in the document id.

    Now the problem is to retrieve the document id. Any body knows the way to retrieve the BPM document id ?

    Or any other work around to achieve this ?
     


    ------------------------------
    Rameshkumar Chandrasekar
    ------------------------------


  • 2.  RE: BPM Document Upload

    Posted Fri December 17, 2021 03:39 AM

    Hi Rameshkumar

    I have done a similar implementation on the browser side:

    - user selects and uploads a CSV file (using a "Complex HTML" containing an <input type="file> element)
    - the CSV is parsed and a NameValuePair list is set (which can be displayed on the UI)

    (The "name" is set with the line number and the "value" with the line content)

    See images showing HTML and Inline Javascript (sorry for the images but I cannot copy/paste code from this rdesktop)



    ------------------------------
    ZAFIRIS KERAMIDAS
    ------------------------------



  • 3.  RE: BPM Document Upload

    IBM TechXchange Speaker
    Posted Fri December 17, 2021 04:43 AM
    You can do this with the OOTB uploader

    Once a file has been uploaded using the "File uploader" a structure is created called "file". Within that structure you can find the docid in a number of places for example file.xhr.responseXML.childNodes[0].textContent and file.xhr.responseXML.all[1].innerHTML

    I use one of these snippets of Javascript to grab the docId (There may be more elegant approaches :-) )

    var ecmid = bpmext.text.trim(file.xhr.responseXML.childNodes[0].textContent);
    OR
    var ecmid = bpmext.text.trim(file.xhr.responseXML.all[1].innerHTML);


    ------------------------------
    Mark Ketteman
    Digital Business Solutions Engineer
    IBM United Kingdom Limited
    London
    ------------------------------



  • 4.  RE: BPM Document Upload

    Posted Fri December 17, 2021 06:50 AM
    Thank you Mark Ketteman. I am able to retrieve it now.

    ------------------------------
    Rameshkumar Chandrasekar
    ------------------------------



  • 5.  RE: BPM Document Upload

    Posted Fri December 17, 2021 06:24 AM
    If you use an OOTB document upload control that contains the "On upload complete" event, such as the "BPM File Dropzone" or "BPM File Uploader", you can add the following code to the event handler to obtain the docId:

    // Note even if multiple documents are uploaded, each one returns their own 'On Upload Complete' message with a single docId per message
    var parser = new DOMParser();
    var xml = parser.parseFromString(message, "text/xml");
    var docId = xml.getElementsByTagName("output")[0].textContent.trim();

    Note that as the comment above says, if multiple documents are uploaded, each one will fire the event and the logic will run separately and be able to obtain each docId.  Hope that snippet helps!


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