Reframework check end process if there is exception

how do we check in the end process if the process ended without exception ? cause I wanted to send an email after the process ended , in the sample below I passed system exception argument toclose all app and added a condition exception is Nothing but the problem is that it still send an email although the end process was called by an exception. Any idea ? thatnks.

Points to remember:

  1. The system exception variable gets reset for every failed transaction(Because the robot moves to initialization state when a system exception is encountered. Observe that there is a system exception transition between process transaction and initialization state. In the initialization state, the first activity sets system exception to nothing. ).
  2. The system exception value is retained only when there’s an exception in the initialization state(Observe that there’s a system exception transition between intialization and end process states).

Assuming that you didn’t modify these transitions, your logic will work only when there’s a system exception encountered in initialization state.

Please check the above steps in your Main workflow. If these are exactly mapped as I said, then you can follow the below suggestion:

  1. Create an Int32 variable(say SystemExceptionCounter) with the highest scope(i.e., General Business Process) and give the default value as 0.
  2. Now in the “System Exception” sequence of the “Set transaction status” workflow, increment this variable(SystemExceptionCounter) value by 1. Remember that you should pass this variable(SystemExceptionCounter) as in/out argument to “Set transaction status” workflow. Or else, you can increment SystemExceptionCounter in the catch block of process transaction state.
    Similarly you can increment SystemExceptionCounter , in case any exception occurs in Initialization and get transaction data states too(if you wish).
  3. Now you can check in the end process state. If this variable(SystemExceptionCounter) = 0, then you can send email.

I hope this helps you. By the way, thanks for asking this question. Even I never thought of retaining the system exception value, until I see your question.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.