Skip to main content
Nintex Community Menu Bar

Cancel K2 Workflow from within custom Server Event code

  • February 25, 2008
  • 1 reply
  • 5 views

Forum|alt.badge.img+2

Hello,


I have a k2 workflow that is a mix of regular K2 calls and custom Server Event code.


If one of the custom Server Event code steps fails, I'd like to cancel the rest of the workflow which consists of regular K2 calls. Is it possible to do this?


 Thanks,


Kim

1 reply

Forum|alt.badge.img+11
  • February 25, 2008

When you say 'Cancel Workflow' do you mean you want to prevent the rest of the workflow activities from executing?  If that is the case, I think there are several different things you could do in a server code event: 



  • You could set an outcome for the activity that has a line rule to an activity with no outcomes 
  • You could goto an activity that has no outcomes

         K2.GotoActivity("Activity Name");



  • You could expire the current activity if it is not in a parallel path

        K2.ExpireActivity(K2.ActivityInstanceDestination.Activity.Name);


There are even a couple more actions under the SourceCode.Workflow.Management API, but I think I'd try one of the above first.