Validation rules for object records can help your organization improve data quality by ensuring that users enter meaningful and correct data. A validation rule contains a formula or expression that evaluates the user-entered data on a field and returns “True,” meaning that the data is valid, or “False,” meaning that the data is invalid.
Some examples of useful validation rules include:
- Approval Date must be after Submitted Date.
- Withdrawn Date must be after Registered Date.
- Discounts for a product cannot exceed 40%.
Vault allows you to configure validation rules for specific object fields at the object level or at the object type level. With object type granularity, you can accurately reflect business rules that differ between object types.
How to Create Validation Rules
To create a validation rule:
- Navigate to Admin > Configuration > Objects and open the object.
- To define the rule at the object level, open the Validation Rules tab. Rules defined at the object level will apply to all records, regardless of object type.
- To define the rule at the object type level, open the Object Types tab, click into an object type, and then scroll down to the Type Validation Rules section. Rules defined within a single object type will only apply to records with that object type.
- Click Create.
- Enter basic details for the validation rule: Label and Name. Name does not appear to users and is only visible via the API.
- Enter an Error Message. This is the alert that users who enter an invalid value will see.
- Select one or more fields in Error Location. These are the fields that the rule will validate.
- In the Validation Expression section, define the validation rule. Learn more about writing expressions in Validation Expressions.
- Click Validate to prompt Vault to check for errors in the expression. If no errors are found, click Save.
Vault begins applying the validation rule immediately for new records. For existing records, Vault applies the validation rule if or when a user edits and attempts to re-save the record.
Validation expressions use the same expression grammar as formula fields and field defaults, but must return a Yes/No (AKA True/False) value.
Supported Field Types
Your Validation Expression can only contain fields with the following data types:
The Validation Expression may use fields in the object you are configuring or fields from a related object (via outbound relationship only).
Available Functions & Operators
Enforcing Validation Rules
Users won’t be able to create a new record or save an edit if field values don’t comply with the validation rules defined for those fields. The configured validation error will appear inline in most cases, but in cases where the field is hidden or the field edit is happening through a lifecycle state entry action, users will see a pop-up dialog with the validation error.
Vault enforces record validation rules any time a record is created or edited, including:
- During bulk record editing or bulk record creation
- When record creation or editing is initiated by Vault Loader
- When record creation or editing is initiated by a user action
- When record creation or editing is initiated by an entry action
- When creating or editing an Inactive object record
- When creating a record through Create and Relate, including Create and Relate from a document
- On field default values
- On fields that are not visible in the page layout
- On fields that are hidden or read-only because of Field Level Security configuration
In some situations, the Validation Expression will automatically resolve to “False” and validation will fail:
- One or more fields in the Validation Expression is blank
- One or more fields in the Validation Expression does not apply to the record’s object type
The following limits apply to object record validation rules:
- Some applications may prevent you from creating rules for certain system, standard, and application standard objects.
- Rule Expression must be 3900 or fewer characters.
- Error Message must be 255 or fewer characters.
- Rule Expression cannot include formula fields.
- Rule Expression cannot include system-managed names.
- Vault does not evaluate validation rules when creating records in migration mode.
You can complete all steps in this article with the standard System Admin or Vault Owner security profile. If your Vault uses custom security profiles, your profile must grant the following permissions:
- Admin: Configuration: Objects: Edit
- Ability to edit Vault object configuration in order to create a record validation rule.