You can configure validation rules to alert users of mistakes and prevent incorrect data from being submitted. They are useful in situations like the following:
- Preventing a form from being saved if the social security number doesn't contain nine characters.
- Validating an IBAN number against the specified format.
We've added new configuration options to validation rules for increased flexibility. With these options, you can:
- Quickly validate individual fields
- Allow the record to be saved with an alert
- Decide where the error messages will be displayed.
Let's look at them one by one.
Quickly validate individual fields
Fields were previously validated only upon clicking the save button. To validate fields as you filled out a form, you had to:
- Ensure that the mandatory fields were filled
- Click the save button to validate a field.
Each click of the save button triggers the execution of all validation rules, displaying error messages throughout the form.
Now, we've added a new option: "Field verify and save". Users may need to quickly validate an important field before they proceed to other fields. In such cases, they can pick Field verify and save for validating those important fields.
Validation will take place when you click the "Verify" button next to the field and when saving the record. This speeds up field verification by allowing you to click a button right next to the filled field and executing only that field's validation rule.
This is available for both validation rules based on criteria and those that use functions.
The field verify and save option is not available in:
- Canvas pages
- Convert /mass convert pages
- Stage closed popup (that appears when a deal is closed)
- Details required popup (that appears when a layout rule is executed for a quick edit in the record detail page), and
- Field of lookup popup.
Allow the record to be saved with an alert
Let's say that you have a company policy that prohibits discounts exceeding 15%, and that your sales reps are encouraged to avoid offering discounts over 10%.
The challenge lies in not allowing values above 15% at all, while also permitting values above 10% but reminding sales reps that discounts above 10% are not ideal.
You can manage situations like this by setting the validation preference as:
- Stop with error (prevents the saving of the record)
- Allow by alert (allows the saving of the record after getting confirmation from the user)
When you choose to stop with an error, the record will not be saved with the entered value. This feature is beneficial for completely blocking the input of inaccurate data. Before this enhancement, this was the default behavior of all validation rules.
With this enhancement, we've added the allow by alert option to remind users to verify the data before saving it. This enables them to save a record after being reminded of the policy and confirming that they understand it, which is useful when the entered value isn't optimal and you want to ensure the user has not made an error.
You can set this preference independently for each condition in your validation rule.
This option is available for validation rules using criteria where the validation happens on Save only.
Decide where the error messages will be displayed
Additionally, you can select where error messages will appear for a specific condition in a validation rule.
If a field's value is not related to another field, it's best to display the error near the field itself. This enables users to quickly identify and correct any mistakes. Therefore, you should select the on primary field option for these scenarios. Previously, all error messages were displayed in this manner.
In complex and data-intensive forms, validation errors may occur due to inter-dependencies between the values entered in different fields. In these cases, consolidating these validation errors in one place can help users resolve these issues more efficiently. With this enhancement, you can choose the top of page option in such scenarios.
You can set the error location separately for each condition in your validation rule.