Error Handling in Transitions
You can add a validation expression to the Transitions tab in the activity properties.
You can use validation to prevent the activity node from moving to another state (for example, to the Completed state) if the conditions are not met.
For example, you can prevent a workflow activity node from completing if the custom activity integer variable “ptc_complete” is less than 0 or greater than 100:
java.lang.Exception e = new Exception("Value for PTC Complete must be between 0 and 100");
if(ptc_complete < 0 || ptc_complete > 100)
{
throw new wt.util.WTException(e);
}
If the task assignee attempts to complete the activity while the “ptc_complete” variable has a value of 120, the action fails. Instead, an error message appears stating: “Value for PTC Complete must be between 0 and 100.”
The user can complete the task when the PTC Complete value is within the acceptable range.
Isto foi útil?