What are validation rules?
Salesforce has a bunch of rules that can be defined on objects and fields. For example, you can define validation rules, workflow rules, process builder, flows, assignment rules, escalation rules, auto-response rules, triggers etc.
Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record. These validation rules help ensure that any record being created or updated qualifies to defined business rules. If not, then developers/ administrators can display required error message.
Validation rule constitutes of:-
Formula — formula to evaluate business rule. If formula evaluates to TRUE, validation error is thrown, else it’s considered as validation success
Error message — error message to be displayed on validation failure
Location — Enables admin/ developer to define location to display validation error. In standard page layouts, it’ll allow user to show error either at page top or beneath the selected field.
How Salesforce processes validation rules?
There are five types of rules in salesforce and the priority of each rule is according to their order.
Salesforce processes rules in the following order.
- Validation Rules.
- Assignment Rules.
- Auto-response Rules.
- Workflow Rules.
- Escalation Rules.
What are workflow rules?
Workflow rules is basically a container or business logic engine which automates certain actions based on particular criteria. If the criteria are met, the actions get executed. When they are not met, records will get saved but no action will get executed.
For example: If it’s raining, then wear a raincoat.
Below is the basic structure of a workflow rule in Salesforce:
Workflow rules can be broken down into two main components:
Criteria: Criteria are conditions you are supposed to put in order to test a record. For example, if you’re from a technical background, what the if statement does in an if/then condition is what criteria mean in a workflow.
Actions: Actions occur after a record meets the criteria. Again, what the then statement does in the if/then condition is what an action means in the workflow.
Disabling Salesforce triggers, workflows and validations when working with Vault
When working with Vault, you may want to disable any automated processes or validation rules you have in place to guarantee a successful backup or recovery operation.
You can disable validation rules while working with EZ-Restore and EZ-Replicate operation in Vault. During EZ- Restore or Replicate, you need to select the data and metadata that contains the rule you want to disable and then turn off the validation rules.
During this operation, all the validation rules of the salesforce components will be deactivated, and the data would be transferred from the source to the destination sandbox. Once the restore / replicate is completed, validation rules will get activated automatically.
Similiar to validation rules, you can disable workflow rules while working with EZ-Restore and EZ-Replicate operation in Vault.
During this operation, all the workflow rules of the salesforce components will be deactivated, and the data would be transferred from the source to the destination sandbox. Once the restore / replicate is completed, workflow rules will get activated automatically.
Workflow / Validation rules are not supported for managed packages at this time.
Triggers and Process Builder Flow
Triggers and Process Builders Flows must be controlled directly from the Salesforce environment.