Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
7 replies Latest Post - ‏2015-02-17T16:47:03Z by RohithBilla
SystemAdmin
SystemAdmin
7615 Posts
ACCEPTED ANSWER

Pinned topic Getting process instance attached document name for document of type File

‏2012-05-01T18:20:28Z |
It doesn't seem possible to retrieve the file name for a document that is attached to a process instance. For a document of type File, TWDocument.uri is consistently null, and I see no other way to retrieve the file name from TWDocument. Published properties for TWDocument are: id, name, version, type, contentType, uri, allVersions, processInstance, hideInPortal, modifiedBy, modificationDate.

Nothing to retrieve the file name.

I thought maybe it was because a document can have several versions, each potentially updated from a different file, but when I narrow on a particular version (e.g. tw.system.currentProcessInstance.documents[0].allVersions[0].uri) , TWDocument.uri still returns null.

Is anyone aware of this limitation or am I going about this the wrong way?
Thank you.

Eric Ducos
EmeriCon, LLC
Updated on 2012-06-27T19:12:44Z at 2012-06-27T19:12:44Z by Goldflake
  • Goldflake
    Goldflake
    30 Posts
    ACCEPTED ANSWER

    Re: Getting process instance attached document name for document of type File

    ‏2012-06-25T15:06:06Z  in response to SystemAdmin
    Hi Eric,

    Are you able to get the file name here using TWDocument API?

    Thanks
    • kolban
      kolban
      3315 Posts
      ACCEPTED ANSWER

      Re: Getting process instance attached document name for document of type File

      ‏2012-06-25T15:30:28Z  in response to Goldflake
      Unfortunately, the TWDocument API is not properly documented in the InfoCenter. I did find this legacy piece of info:

      http://bpmwiki.blueworkslive.com/display/tw7/TWDocument

      At first I though "oooh" the "name" attribute will give me the original document file name ... sadly not It appears that the "name" attribute corresponds to the user entered "title" attribute in the document attachment widget.

      On a new note ... as I start to study the v8 product, I get the distinct impression that the whole notion of the IBM BPM managed documents is desired to be a thing of the past. What I see in v8 is a lot of support for CMIS to interact with arbitrary ECM systems.

      Neil
  • SystemAdmin
    SystemAdmin
    7615 Posts
    ACCEPTED ANSWER

    Re: Getting process instance attached document name for document of type File

    ‏2012-06-26T07:41:35Z  in response to SystemAdmin
    Hi there,

    That is how my application dynamical generates links to our process instances attached documents:
    hope you will find it helpful.

    var docs=tw.system.currentProcessInstance.findDocuments(docsPropMap,TWDocument.Types.File);

    //build link to the first attached document in the array
    if(docs[0]!=undefined)
    {
    var numOfVersions=docs[0].allVersions.length;

    if(docs[0].allVersions.length!=0)
    {
    //here comes the script from the attached file 'link.txt' above.
    }
    }

    Attachments

    • Goldflake
      Goldflake
      30 Posts
      ACCEPTED ANSWER

      Re: Getting process instance attached document name for document of type File

      ‏2012-06-26T11:42:49Z  in response to SystemAdmin
      Hi Sason,

      Could you please tell me how to use

      tw.system.currentProcessInstance.findDocuments(docsPropMap,TWDocument.Types.File);. I could not exact information on the wiki site.

      Here i am unable to get how to configure the first param , the Map type.

      Thanks,
      Kamruddin
      • SystemAdmin
        SystemAdmin
        7615 Posts
        ACCEPTED ANSWER

        Re: Getting process instance attached document name for document of type File

        ‏2012-06-27T06:14:06Z  in response to Goldflake
        Hi,

        The first argument in the "findDocuments" method is a map of your document attached properties.
        This can be helpful in case you want to retrieve particular document
        based on specific property it has.

        Small review about those properties:

        In the control you can 'color' each of your uploaded document with property and value.
        You define those properties and their values in the table under "Upload Document" section
        And later on, display those documents in another control based on those particular properties. (in the table Under "Display Documents" section)

        Now for your configuration question,

        In case you defined properties in the control attachment table , you need to init a map and add property/value according to your desired results, otherwise
        I guess you need to pass an empty map.

        I tested this method, only when I had to query instances, documents and their properties,
        never tried to query with an empty map.

        Hope that helped!
        • Goldflake
          Goldflake
          30 Posts
          ACCEPTED ANSWER

          Re: Getting process instance attached document name for document of type File

          ‏2012-06-27T19:12:44Z  in response to SystemAdmin
          Thanks Sason,

          It helped a lot.
          • RohithBilla
            RohithBilla
            27 Posts
            ACCEPTED ANSWER

            Re: Getting process instance attached document name for document of type File

            ‏2015-02-17T16:47:03Z  in response to Goldflake

            Hi Goldflake,

             

            Were you able to retrieve the documents using this functionality tw.system.currentProcessInstance.findDocuments(properties, searchType). If yes can you please explain the search type used and properties. 

             

            Thank You,

            Billa