Adding an OnStart Script to Evaluate Activity Inputs


On this page

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.


The following script checks whether the username and email values for a new account are missing. If the values are missing, the workflow fails.

  1. 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.

  2. 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 ( == null || == 0)


    workflow.setFailed("missing email address");


    Tip: To add variables, click Insert Variable.

  3. Click OK.

Opening the Workflow Activity Properties