Object Validators for Business Objects

An object-level validation rule is a constraint you can define on any custom object. The rule is used to evaluate the object when attempting to submit an object.

An object-level rule is appropriate when validation requires using two or more fields. Validation using an object-level rule ensures that regardless of the order in which the user assigns the values, the rule will be consistently enforced.

The expression or script that defines the rule must return a boolean value that indicates whether the object is valid. The object is saved if all the rules validating the object return true. If any of the rules return false, the error message of the failed rule is displayed and the object is not saved. If the rule returns true, then the object validation will succeed so long as all other object-level rules on the same object return true. For example, this type of validation would be needed when specifying a value for one field in a form requires that a value is also assigned to another field (for example, selecting ‘High’ in a Priority field requires a name is entered in the Assignee field).

To create a validation rule for a business object:

  1. Select the business object for which you want to create the rule.

  2. Select the Business Rules tab of the business object.

  3. Click the Object Validators tab.
    Description of bo-object-validators.png follows
    Description of the illustration bo-object-validators.png

    You see a list of all object validators that are defined for the business object.

  4. Click + New Object Validator and enter a validator name to identify the rule, and then enter the error message to be displayed if validation fails.

    You can optionally override the default Groovy timeout specified in the Timeout Override field.

    It's possible to modify all of these later if you want.

  5. Click Create Object Validator in the dialog box to open the editor.

  6. Create your rule by typing in the editor and by using the business object fields and functions in the palettes. Use the palettes to help you add fields and functions that you might use to create your rule.

    Click the arrow next to the function or field in the palette to insert it at your insert cursor in the editor. When you select a function in the palette, a description of the function and an example of how to use it are displayed in the palette. Any object functions that you created for the business object will be listed in the Functions palette.

  7. Click the Object Validators tab again to apply your rule to the object and exit the editor.