All product information in wiki.bizagi.com is only valid for Bizagi BPM Suite 9.1.X.
For newer Bizagi BPM Suite versions (10.X and up) please visit the User Guide.
 

Launch cancelation or error events using code

From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS

Jump to: navigation, search

<keywords content="keywords">

launching cancelation event, launching error event, events using code

</keywords>

How to launch cancelation or error events using code

There are cases where it is necessary to launch cancellation or error events by means of code, for example, when a Web service fails due to connection errors etc. In these cases the cancellation or error event can be executed using the function CHelper.RaiseCancelEndEvent o CHelper.RaiseErrorEndEvent.

Example:
try 
{
     //Web Service
     var res = CWebService.invokeWS("http://testserver/WsVerticalScopes/ApplicantAnalysis.asmx","ExistClient",[]);

     if (res == 1001) 
     {
          CHelper.RaiseCancelEndEvent("1001");
     }
} 
catch (Exception) 
{
     CHelper.RaiseErrorEndEvent("Excepcion");
}


The rule executes a Web service, if it returns the result 1001 execute the cancellation event, in case an error in the connection is generated and a reversion is required but no compensation then the error path is executed using the command RaiseErrorEndEvent. <comments />