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.
5 replies Latest Post - ‏2013-02-11T06:16:37Z by barsa4ever
barsa4ever
barsa4ever
100 Posts
ACCEPTED ANSWER

Pinned topic how to get documents, attached to startable service?

‏2013-02-07T11:00:02Z |
Hello, guys.
Am i missing something, or there is no OOTB way to handle attached documents on server?
Something like this

tw.system.currentProcessInstance.documents

but for startable service?

The only solution, I have for now is

var bpdDocDelegate = Packages.com.lombardisoftware.client.delegate.BPDInstanceDocumentAPIDelegateFactory.getInstance().newInstance(); var docs = bpdDocDelegate.getDocumentsByInstance(-1).toArray();

But it doesn't looks like shiny one.
Actually (if it helps) I need to find files with particular value in particular property.
Any ideas appreciated!
Updated on 2013-02-11T06:16:37Z at 2013-02-11T06:16:37Z by barsa4ever
  • barsa4ever
    barsa4ever
    100 Posts
    ACCEPTED ANSWER

    Re: how to get documents, attached to startable service?

    ‏2013-02-07T11:03:01Z  in response to barsa4ever
    We are talking about 7.5.1 now.
    • SystemAdmin
      SystemAdmin
      7615 Posts
      ACCEPTED ANSWER

      Re: how to get documents, attached to startable service?

      ‏2013-02-07T22:08:22Z  in response to barsa4ever
      A startable service is a service running on its own, not within the context of a BPD instance. As such the BPD instance in your call would be "null" so the rest would not work.

      Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
      • barsa4ever
        barsa4ever
        100 Posts
        ACCEPTED ANSWER

        Re: how to get documents, attached to startable service?

        ‏2013-02-08T06:06:27Z  in response to SystemAdmin
        Andrew, first of all, thanks for response.
        But your answer is confusing, because you posted exactly the same that i post.
        Right because of I running startable service, I can't use something like this
        
        tw.system.currentProcessInstance.documents
        

        And my question is about any approaches of get and handle attach docs for startable service. Something like code above, but working one.
        The only option I have for now is to use
        
        var bpdDocDelegate = Packages.com.lombardisoftware.client.delegate.BPDInstanceDocumentAPIDelegateFactory.getInstance().newInstance(); var docs = 
        
        new Array(); docs = bpdDocDelegate.getDocumentsByInstance(-1).toArray();
        

        And it actually works. But as you can see, it's a little outside of common soultions, it use java library, that is deep inside BPM and there is no garantee, that it will works later after major updates of software.
        • SystemAdmin
          SystemAdmin
          7615 Posts
          ACCEPTED ANSWER

          Re: how to get documents, attached to startable service?

          ‏2013-02-08T16:44:58Z  in response to barsa4ever
          I guess what we need it more insight into what you are trying to do. For example -

          "I'm trying to use a startable service. This has a 7.5 coach(?) that had a document attachment widget. When the user submits the coach I need to…." or

          "There is a process instance that is assoicated with a set of documents. I have a startable service and I want to display the instance documents in a 7.5 coach in that service"

          2 really different use cases, but both could cause a user to post what you posted. I posted what I did because it was not clear in your original post you understood the reason why currentProcessInstance wasn't available to you.

          So if you tell us what you want to do in the service, we might be able to give you more useful ideas.

          Andrew Paier | Director of Special Operations | BP3 Global, Inc. www.bp-3.com
          • barsa4ever
            barsa4ever
            100 Posts
            ACCEPTED ANSWER

            Re: how to get documents, attached to startable service?

            ‏2013-02-11T06:16:37Z  in response to SystemAdmin
            Andrew, sorry for being ambiguous.
            My usercase us similar with your first example.
            I need to create startable service with document widget on it. And after user submits a form, I need to save files to sharepoint. So basically I need to handle documents attached to startable server in general system service — get its properties, blob, etc.

            However, my best option now is this piece of code
            
            var docsPropMap = 
            
            new Packages.java.util.HashMap(); docsPropMap.put(
            'some_id', tw.local.id); var bpdDocDelegate = Packages.com.lombardisoftware.client.delegate.BPDInstanceDocumentAPIDelegateFactory.getInstance().newInstance(); var docs = 
            
            new Array(); docs = bpdDocDelegate.getDocumentsByProperties(-1, docsPropMap, true, 
            
            true).toArray();
            

            It search only through startable services (bpdInstanceId equals -1) and through «some_id» property among it.