Validate Data in a Workflow

It is common for workflows to require some basic data validation to ensure that quality standards are met for the provided data. Data validation can be easily accomplished in a workflow by applying conditions on transitions.

Business conditions will always evaluate to either true or false. In workflows they can be applied on transitions, and thus determine whether or not a transition can be performed. If a condition evaluates to true, the task may take the transition. If a condition evaluates to false, the task cannot take the transition and must attempt another transition or remain in the state until the data has been corrected and the condition evaluates to true.

When using conditions for basic data validation, the transitions are generally applied on user-accessed states, so that the user accesses an error when attempting to submit via a particular transition if the data does not validate. Note that conditions should not be used to validate that mandatory attributes are populated as that can be done using the built-in mandatory attribute functionality, described in the Mandatory Attributes and References in Workflows topic here.

Data validation can be carried out using any number of functions and/or JavaScript. Additional information on more advanced topics can be found in the Business Rules section of the documentation here. The below provides a simple example of data validation using the attribute value comparison function.

The below example will check to ensure that an attribute, List Price, has a value greater than or equal to .99. It assumes that a workflow has already been created and a transition exists on which the condition can be added.

  1. Double-click on the transition, select the Condition tab, then click the Add new Business Condition link.

  1. Click the Edit Operation icon, select Attribute Value Comparison from the dropdown.

  1. Click the ellipsis button () to select an attribute. Choose an operator from the dropdown, insert a value for comparison, and click Save.

  1. Click the [X] in the upper right corner of the Transition Editor to close it, then save and exit the workflow.

Users attempting to submit a task that does not meet the condition will receive an error.

Note that by default, the condition also checks for the presence of a value, returning false when no value is present.