Skip to main content

I have a parallel workflow, each task activity has 3 outcomes Approve, Minor Reject, Major reject. Approve and Minor Reject will go to individual workflow path so there is no dependency between multiple paths. Major Reject should update overall status as Rejected and need to complete workflow. Because this workflow has different paths in parallel, Major reject in one path is not completing the workflow.


I added Server Event(Code) to Major Reject activity and written following code. After writing this code I am not able to edit remaining tasks which I think all these pending activities are expired nicely as expected but workflow status is still in "In Progress". I want this to be in Completed status. How to do that?


 K2.Synchronous =  true/false;



K2.GotoActivity(







 




"Major Reject", true);




 


=========================================================================





foreach(ActivityInstance oActInst in K2.ProcessInstance.ActivityInstances)



 



 



 



{ 


if (oActInst.Activity.Name != "Major Reject")

{


K2.ExpireActivity(oActInst.Activity.Name);  


}


}


Thanks for your time.


Kiran Batta.




 

The workflow status won't change to "Completed" until a) all activities are complete or expired, and/or b) there are no logical paths left for your process to follow.


Is there another activity waiting user input that starts after all of the current activities are expired?


Hello Brown,


Thanks for your reply. All the awaiting user input activities starts in second step paralelly. If anyone of the activity result is Major Reject, it goes to Major Reject activity, from then it is single path. So I used GoToActivity and ExpireActivity methods in Major Reject activity to expire/complete awaiting user input activities in 2nd step and none starts after this activity. I hope you understood this, prepared a sample flow.


                                                                     Start


                                                             /                      


                                            User Input1               User Input 2


                                         /                                    /                


                             Approve             Major Reject                Approve


                                                                    |


                                                         Final steps                                    


Based on your diagram I am making the assumption that you have a separate activity for "User Input1" and "User Input2", any reason why you don't have a single activity with multiple destinations users? If in the dest rule you have User1 and User2 it will by default be assigned to both users, the actions determine what the user can do with task e.g. Approve, Major Decline. The Outcome rule determines what todo with the remaining tasks associated with the activity and will evaluate every time a user action a tasks, for example if user 1 selects Major decline and the outcome rule looks for 1 x Major Decline the related tasks will expire and the line associated with that outcome will execute.


With this you don't have to worry about Expire and Goto actions to get the workflow to stop.


Reply