GoToActivity on process level exception

  • 8 September 2014
  • 3 replies
  • 0 views

Badge +10

As the title, says if a exception occurs on the process I want to send the process to an activity regardless of which event cause the error. However, the GoToActivty method is not avalible in the K2 context in the exception code but it is available in the code event code. Has anyone got any  suggestions.


3 replies

Badge +8

Haven't done it, but I'm pretty sure you need to use process-level exception rules.  This guy has an example.

Badge +10

THanks for yor reply but thats excatly what I am doing. If you try to insert "K2.GoToActivty("Test Activity")". The GoToActivity method is not available in the exception code area.However I can put this same line of code in a code event for example.

 

@Edit: Let me ask this question differently. Is is posible to set a proces level exception so that, if for any reason the process goes into error, close the current instance and start a new instance.

Badge +10

If anyone is implementing a similiar solution. K2 support have provided a solution to cast ContextServer object to appropriate classes, like ServerEvent. Then you have all the methods for that class.

 

Eg, to send process to an activity if an exception occurs:

 

private void Properties_ExecuteCode(object sender, EventArgs e)
{


SourceCode.KO.ServerEventContext oServerEvent = (SourceCode.KO.ServerEventContext)K2.ContextObject;
oServerEvent.GoToActivity("Regenerate",true);

 

Hope this helps someone.

Thanks

 

 

 

Reply