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?
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.
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.
@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?
I think I understand you requirement better. You can achieve this by following these steps:
Hope this makes sense.
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?
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.