To terminate a Workflow Job at a specific time and throw a specific exception, you can use the Terminate Workflow activity. The TerminateWorkflow activity immediately ends the Workflow Job with the specified exception and a Final Severity of "Error".
The TryCatch activity in the Workflow can be used to catch an exception created by another activity. For more control of the final output, use the TerminateWorkflow activity in the Catches section of the TryCatch block and provide a custom reason.
TerminateWorkflow Activity Properties
Property | Description |
DisplayName |
Enter the text that is displayed for the TerminateWorkflow activity within the Workflow Job. |
Exception |
Enter the exception to end the Workflow Job. The exception is displayed in the log file from the Monitor view.
NOTE: The exception must be fully qualified using the System namespace. For additional information on common exception types and when to use them, see the Exception Class article. |
Reason |
Enter the text that will be displayed in the Description field in the Monitor view. It is also displayed as the final status in the log file from the Monitor view. |
Adding a TerminateWorkflow Activity to a Workflow Job
- Click Definitions from the Shortcuts menu.
- Right-click the Workflow Job and select Properties.
- Click the Source tab.
- Under the Toolbox, expand the Runtime section.
- Drag and drop the TerminateWorkflow activity onto the Activity panel.
- In the Properties panel, enter values for the exception and reason.
- Click Save and Close.
Viewing the Terminated Workflow Job
After the Workflow Job runs, you can view the reason and the exception.
- Run the Workflow Job.
- Click Monitor from the Shortcuts menu.
- View the Reason in the Description field in the Monitor view.
- Double-click the Workflow Job.
- Click the Log File tab.
- View the reason and the exception values in the log.
- Close the window.
Comments