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)
if (activity.email == null || activity.email.length() == 0)
workflow.setFailed("missing email address");
Tip: To add variables, click Insert Variable.