Referencing data from another process?

  • 1 April 2014
  • 9 replies
  • 0 views

Badge +8

I have a process that will be kicked off by any off several other processes.  I need to be able to easily grab data from the "parent" process to make use of it in the "child" process.  I will be storing the ID of the "parent" process in each "child" process.

 

My first thought was to add a Reference to the child process (we always build SmartObjects for all of our processes), because data in the parent process could continue to change after the child process is started and I need current values in the child process.  However, I have found that K2 only deploys a List method for process SmartObjects, and I can't seem to find a way to filter the SmartObject reference down to the appropriate process instance.

 

What is the proper way to handle this scenario?


9 replies

Badge +3

Typically we create a SmartObject specific for a child process data with a link to tha parent process.  It depends on wether you are using a SmartBox SmartObject or SQL based one but make sure your child has primary key this will expose the Create, Load and Delete methods.  Rule of thumb is only store your look up ID's in your process data fields.  It's too tricky to get process data fields out of the workflow or to modify them is something should break or stop working. 

 

Typically the Process SmartObjects that k2 will generate have one method - Start Process.  You can also look at the System SmartObjects that contain Acitivity and process data if you have to use Process Data fields.  Again not the easiest route but possible.

 

Paul

Badge +3

If you have the Process Instance ID from the parent process you can use the List method of the Process Instance smart object under the Workflow Reports>Workflow General category.

 

The List method can accept the Process Instance ID as a input field so you can filter by that particular process instance.

 

 


14302i43A2D80D9E11CB73.png
Badge +8

@MASWorkflow: Data I need access to is in another process, not SmartBox or SQL.

 

@KennyC: Yeah, I know I can filter.  Trouble is I will be using data from the parent process in lots of places in the child process, so I was hoping that I could do the filter once in one place (e.g. a Reference) and use the reference in all of those places.  Fewer chances to fat finger something, ya know?

Badge +3

Hi sbrownhuntoilco,

 

I think I understand you requirement better. You can achieve this by following these steps:

 

  1. Add a reference to the smart object method from the References node in the Object Browser.
  2. You can specify the input mapping / filter here.
  3.  In one of the events (e.g. Data event), you can execute the referenced smart object method and copy the return value to a data field for example.

Hope this makes sense.


14231iBB1C56E10937E0EF.png
16980i7E753AF2D62E0609.png
14599iA9102548FB79BCF7.png
Badge +8

@KennyC wrote:
You can specify the input mapping / filter here.

That's what I was hoping for, but I don't get any fields to map on that screen (see attached).  I don't see them in the SmartObject Tester app either.

 

Is there some magic sauce I have to add to the SmartObject to enable this?


12477i941683E863BBD34C.png
Badge +3

Hi sbrownhuntoilco,

 

What smart object method are you calling? It could be the fact that the smart object method does require or accept any input properties.

Badge +8

I'm calling the List method on the SmartObject generated by K2 for my process.

Badge +3

Oh I see.

 

Yes I have just tried with one of the smart objects for a workflow. There is only one List Process Instances method that does not allow you to specify any input properties as you stated in the original post.

 

I am not sure you can do this with the workflow generated smart objects under the Workflow Solutions category. Would it be possible to use the generic Process Instance SO under Workflow General category?

 

If you need access to the process data fields the Process Data SO in the same category may give you what you need.

Badge +8

Yeah, I might have to use the Process Data SmartObject field by field.

 

Ugly, but it might do the trick.

Reply