Skip to main content

Hi there,


I have a workflow that works and now needs some enhancement.


System: Infopath as web service form, integrated with K2 and MOSS.


Current process: Once the form was submitted, it will go to the approver as in status of "Pending for approval". It also appears in the approver's worklist.


At this stage, my intention is to allow the originator to cancel the form which also will end the whole process.


I just want to know some idea of how to get this done. What "event" to use and so on?


I have used "InfoPath Client Event" for the approver to Approve and Decline. I guess I will be using the same event to cancel the form??


Or perhaps other event such as "Default Server Event (Code)" to write some codes to stop it??  Include "Cancel" dropdown in the InfoPath form. 


Please find the attached image. Appreciate your help in advance.


Cheers............


11760i55338132D43128A5.jpg

This is a common need and there are a number of ways you could approach this problem. 



One way would be to add a parallel path to your workflow, perhaps from the Start activity or IT Requisition activity.  When you have multiple lines coming out of an activity and more than one has a condition that is true, the workflow will split into parallel paths.   Your new path might go back to the originator with some sort of client event that allows them to cancel. 



When you have two parallel paths, the workflow won’t end until all paths are complete.  Let’s say the originator decides to cancel.  You will need to end the main path and perhaps perform some tasks to note it was cancelled.  After the originator cancels the request, you can stop the other path by using the GotoActivity API call in a server code event:



K2.GotoActivity("SomeActivity");



The GotoActivity has a useful side-effect in that it cancels all parallel paths when it goes to the specified activity.  In this activity you could perform any clean-up work and let the workflow end.



Another common situation is the originator should no longer be allowed to cancel after the main path gets to a certain point.  In this case, you could again use GotoActivity on the main path to cancel the originator’s path.  One word of caution:  avoid overuse of GotoActivity.  If you use this too much, it can make your workflow very difficult for someone else to follow as the logic will no longer be in the lines, but in code.



There are a number of other discussions in the forums on this topic so you might want to look around for other ideas.


Reply