What is a Validation Rule?
Validation rules allow for values which are or are not allowed on a specific field. Validation rules apply when adding or editing a field, both in the Builder and on Live App pages, and appear as a message if the rule has not been met. For example, you can:
Limit the number of characters in a paragraph text field
Restrict files to specific types and sizes
Allow only a specific range of numbers and dates
Run your own regular expressions on a Short Text field
- Set password minimum and maximum character counts on a User Role password field
Manage Validation Rules
Add a Validation Rule
From the "Data" section in the Builder, select the object where the field is located, where you want to add your validation rule. In order to add a validation rule to a field, you'll need to edit that field. To do so, click on the gear icon on the field.
- Click on the Validation Rules tab from the Advanced Options modal.
- Check the checkbox next to "Add field validation rules" to start adding rules for this field.
- Add your When condition: a field on that object, the condition, and the value. Available conditions will depending on the type of the field chosen.
- Type the message you want to appear when the condition in the When section is not met.
- Click on the "Add Rule" button if you'd like to add additional validation rules for this field. See the section below Multiple Validation Rules for details on more than one validation rule on a field.
The above rule states that When this field's character count is higher than 500, we will display a custom message alerting the user has gone over that character count.
Edit a Validation Rule
From the "Data" section in the Builder, select the object where the field is located, where you want to edit your validation rule. Click the gear icon on the field where the validation rule is saved, and then click on the "Validation Rules" tab to edit those rules.
Delete a Validation Rule
From the "Data" section in the Builder, select the object where the field is located, where you want to delete a validation rule. Click the gear icon on the field where the validation rule is saved, and then click on the "Validation Rules" tab to delete a rule.
Use the red circle with the minus sign to remove an individual rule.
Uncheck the checkbox "Add field validation rules" to remove all validation rules from the field you are editing.
Warning: Unchecking the "Add field validation rules" or the minus icon on an individual rules is destructive and will cause all rule(s) to be removed, so confirm this is the correct action in your app before proceeding.
Multiple Validation Rules
You can add multiple validation rules to a single field to check for different conditions. If no conditions match (that is, if no rules are broken), the field will submit as usual:
When a validation rule finds a match, your user will be notified and the affected field will be highlighted:
Notes & Troubleshooting
- Fields that have at least one validation rule applied will show with a check mark icon adjacent to the field name on the Builder fields page.
Validation Rules only work for form submissions and inline edits.
Imports, form rules, and batch updates do not perform validation checks.