Skip to main content


 

Symptoms


we have created a workflow that starts sub-processes for all records in a SmartObject list method, and had the following issue: when we configure the IPC event to start workflows synchronously, all sub-processes are started correctly. But if we configure the IPC event as asynchronous, it starts one workflow only for the first record of the SMO list method. We could not find any error in K2 host server logs.
 

Diagnoses


We noted that the activity was missing succeeding rule (to wait for all events to complete).

Here is an extract from the K2 Blackpearl Core - 200.AUS-Building_Workflow_Solutions_with_K2_Studio-Intermediate (REF: http://help.k2.com/k2lm-200aus.aspx):
------------------------------------------------------------------------------------------------------------------------------------

"Outcomes/Succeeding Rules:
After all the events in the activity are executed, K2 evaluates the Outcomes* or Succeeding Rules** for the activity to determine whether the activity can be completed.
If any Outcome or Succeeding rule is met for the activity, K2 will expire any other active instances of the activity and continue with the workflow. This is why it is possible to define a business rule like “2 users must approve the request” or “1 user must reject the request”. If the first user rejects the request, one of the outcomes for the activity is successful and K2 automatically expires the other approver’s task, because there is no need to wait for them to give their input into the task.
*Outcomes are used to evaluate the input from users in activities where Client Events are present **Succeeding Rules are used in activities where only Server Events are present.
Under the covers, Outcomes and Succeeding Rules are actually the same thing they just evaluate different data to determine whether to complete the activity and continue with the workflow or not.

A Succeeding Rule is commonly defined on activities that do not have Client Events but that require similar functionality as an Outcome.
Here is an example: suppose a Parent workflow uses multiple slots of an activity to start multiple child workflows. We may need to wait for each child workflow to complete before allowing the activity in the parent workflow to complete. You can achieve this with a Succeeding Rule on the activity in the parent workflow: simply create a succeeding rule that checks whether the Status of each instance (ActivityInstanceDestStatus) is Completed. The activity will not complete until all slots have completed. "

------------------------------------------------------------------------------------------

So all that is needed is to use succeeding rule to wait for all events to complete. The same like you would do with Client Events, when you evaluate outcome and calculate:
- Either at least 1 rejected – not waiting for all users to complete the task
- OR all slots Approved – waiting for all users to complete the task!

 

Resolution

Add Succeeding rule.




 
Be the first to reply!

Reply