• 1 reply
  • Latest Post - ‏2013-06-25T15:27:12Z by Todor Mollov
9 Posts

Pinned topic BPM 7.5 - Retrieve and Use an Attachment

‏2013-06-25T15:13:06Z | attach attached attachment bpm bpm75 document twattacheddocument twdocument

Hi to All,

in my process I inserted in a coach the possibility of attach a file.

Then, I would to write this file in a DB as a blob, or a clob, but here I have some problems, in fact I don't know what library can I use to make this possible.

The perfect solution is to convert my file (it will be always a PDF or a TextFile) in a string Base64.

Searching on web, I found some examples with TWDocument and TWAttachedDocument but:

  • TWDocument (and related methods) is not recognized by IBM Process Designer.
  • TWAttachedDocument IS recognized by IBM Process Designer, and its methods are also suggested, but when I try to use it the process crashs with the following alert:

CWLLG2041E:  TeamWorksJavaScriptException created non-nested.   Error: [TeamworksException name='ReferenceError', message='ReferenceError: "TWAttachedDocument" is not defined.', line=0, pos=0 nested=<none>]

In TWAttachedDocument I found the method "TWAttachedDocument.findById(id).textData" that seems to be what I want.

Somebody can help me?


  • Todor Mollov
    Todor Mollov
    34 Posts

    Re: BPM 7.5 - Retrieve and Use an Attachment


    It really depends on what you are trying to achieve.

    Assuming you use the OOTB functionality, then all attached files are already in the BPM DB. If then you want to extract the file from the DB and send it elsewhere, then you will have problems assigning this to a BPM variable. I would suggest a java solution to Base64 it to a String and then work with this string variable in your BPD.

    I cannot remember off the top of my head, but I'm pretty sure there is no JavaScript variable to hold the attachment content. You can either use direct JDBC call to get it from the BPM DB or use the REST API.