Skip to main content

Hi all,

 

Got a problem, I would like you advice on. Scenario is:

 

I have a parent process and that parent process calls a child process using an IPC event. This is a synchronous call and the child process has several activities that must be performed by the user before it completes and the parent process continues onto the next one. The issue I am facing is, I need to provide an interface where a user can go and cancel a parent process instance and that will automatically cancel any child activities. I have not been able to achieve this. I have looked at some of the API and I am not able to retrieve the child process instances' using the parent process Id. I can see this data in the K2 database table but unfortunately we do not have permission to speak directly to the K2 database. How can I achieve this either using the K2 API or using one of the out of the box smartobjects?

 

Please advise.

Perhaps this post can assist:


 


http://community.k2.com/t5/K2-blackpearl/Getting-child-process-ID-from-IPC-Event/td-p/50407


 


1.  They are passing the parent process instance ID to the folio of the child IPC


 


2.  Using management API to retrieve process instance with folio containing parent proicess instance ID (assuming there are not other number fields in the folio that return incorrect process instances); perhaps appending a string in front of ID to make is use such as 'pid1234' such that you can just filter by 'pid1234' instead of just '1234'; the folio also happen to contain other numbers


 


Thanks tin for your reply. I looked at that post but its not a good solution in my case, because it requires modification to the process and the result will only be forwards compatible (if that makes sense), but I have lots of older active process instances which needs to be cancelled the same way as the new processes will be. Otherwise its going to get a lot confusing for the users. It is very fustrating because I can see this data is stored in the K2 database and I was hoping for a method in the K2 api that would expose this data.


You can do this without code and without using the untidy adding the parent process Id to the folio of the child.

 

Simply create a datafield (e.g. ParentProcessID) in your child process and populate that when it is spawned by the parent.

 

To retrieve the children, you can then use the SmartObjects under Workflow Reports - Workflow Solutions - MyProcessName] - List Process Instances

 

In that method , you can set a filter on ParentProcessId passing in the parent process id and returning a list of children IPCs


Reply