How to pause the parent process until child process completes a particular activity


Badge +2

Hi,


Our requirement is to have a IPC Event in parent process to trigger child workflow but parent process can continue processing only after child process reaches particular activity(not complete).


What is the best practice to achive this?


Should we use GotoActivity or use StopProcessInstance to pause parent and then StartProcessInstance to resume parent process.


Thanks,
Shilpa


2 replies

Badge +10

This is a little tricky but sounds possible.  The techniques I would try would be to:


1.  Start the child process with the IPC event but set it to be asynchronous so that the parent workflow will not wait at the IPC event for the child to finish.  You'll also need to pass the K2 serial number for that activity to the child process which can be generated from the K2 workflow context with the Process ID and the Activity ID.


2.  Add an default server event right after the IPC event and make it an async server event.  This will cause the parent to wait for another application (or process) to call into it and finish the event (it can also pass data into it as well). 


3.  In the child process add the code at the particular activity that needs to call the parent so that it can continue.  This is where you'll need to use that serial number that was passed from the parent so that the child knows exactly what parent process and activity to call back into.


Here is more information about using the async server event and even some sample code about how to call back into the server event:  http://help.k2.com/en/kb000272.aspx


I hope this helps.


Tim

Badge +9

Alternatively, you could try calling your IPC asynchronously but have a line rule/complete rule that checks the value of a process-level data field that gets set to true within your IPC call

Reply