Using Validation Scripts
A validation script is used to validate data before it is sent to the external software application. Validation scripts are configured on input fields and contain a C# expression. Throw an exception to prevent data being sent to the external software application.
When an object field or method field contains a validation script, it is visible by a checkmark after the name of the field as displayed in the next figure.

Validation scripts are specified in the object or method field and typically contain a simple condition followed by an exception. The example below shows a simple condition on line 1 where the validation script checks if the price is lower than zero. If it is lower than zero, the condition is true and line 2 will be executed. Line 2 throws a new exception, which basically means that the user will see the error message “Price cannot be lower than zero!”
if ({$Price} <= 0)
throw new Exception("Price cannot be lower than zero!");
Example 1 – Check on Valid Date of Birth
The following validation script will check if the date of birth is greater than today’s date. If the condition is true, the user will see an error message.
if ({$DateOfBirth} > DateTime.Now)
throw new Exception("Date of birth cannot be greater than today.");