You can execute Java or JavaScript after the input activities are evaluated, which is useful for validating activity inputs before they are processed in the workflow. If the inputs are invalid, you can perform operations such as failing the activity.
Example
The following script checks whether the username and email values for a new account are missing. If the values are missing, the workflow fails.
For the activity that you want to add an OnStart script to, open the activity properties.
The activity properties appear at the bottom of the workflow design area.
On the OnStart Script tab, enter the following code:
#OnStart Script Sample
if (activity.userName == null || activity.userName.length() == 0)
{
workflow.setFailed("missing username");
}
if (activity.email == null || activity.email.length() == 0)
{
workflow.setFailed("missing email address");
}Tip: To add variables, click Insert Variable.
Click OK.