Salesforce workflow automates certain actions based on certain criteria. For example, if the rule is met, the actions will be executed; if not, the record will be saved but no action will occur.
It is basically an engine that automates certain actions based on certain rules.
Components of Workflow in Salesforce
Criteria: In a workflow, criteria refer to conditions that must be met in order to test the record. For example, if you come from technical background what the if statement does in an if/then the condition is what criteria mean.
Actions: After a record meets the criteria, it is an action. Again this is what the then statement does in the if/then condition.
There are 3 types of evaluation criteria for Workflows in Salesforce:
- Created: When a record is created and the criteria match, the action is executed.
- Created and edited it: When a record is created or updated, the action is executed.
- Created and every time it’s edited to subsequently meet the criteria: If a record is created and meets the criteria, the action will be performed. If the record is edited and does not meet the criteria, the action will not be performed.
- Suppose a record is created that does not meet the criteria, but then it is edited and updated again to meet the criteria. This record will be evaluated again to determine whether it meets the criteria or not.
Don't forget to check out: Deploying Workflows Through Change Set | The Salesforce Developer Guide
Actions in workflow rules are of 2 types based on when they are executed:
- Immediate Actions: These actions are carried out at once when the criteria for a rule are met.
- Time-Triggered Actions: This type of action is executed at a specific time period which is specified when creating this kind of action. After the action has been executed it again verifies that the record matches the criteria. If yes then it executes the action otherwise not.
There are 4 actions which can be specified in a workflow rule:
Email Alert: Email templates are used to send automated emails.
There are four types of email templates in Salesforce:
- Text: The text of email templates can be created or changed by all users.
- HTML with letterhead: A leterhead templates can be created by admins and users with “Edit HTML Templates” permission.
- Custom HTML: HTML email templates can be created without a letterhead by the administrator and users with the “Edit HTML Templates” permission.
- Visualforce: Developers and administrators can create templates using Visualforce.
Field Update: A Field updates is an automatic change in the field value on a record that triggered the workflow rule in the first place. When “Re-evaluate Workflow Rules after Field Change” is enabled for a field update action then Salesforce re-evaluates all workflow rules on the object if the field update results in a change in value.
A cross-object field update can be used for updating fields on a related master record, but it is not available when re-evaluation is checked.
Tasks: The task is simply assigned to a user, owner or role. We can also send a notification email to the assignee when the task is assigned automatically. The tasks should be assigned to roles if there is only one user assigned to the role. If there is more than one user assigned to that role then the task is automatically assigned to the owner of the workflow rule users who triggered the workflow rule.
Check out another amazing blog by Navdita here: Here's All You Need to Learn About Apps and Tabs in Salesforce
Outbound Message: When an outbound message is sent to an external service, like an external service, it is assigned to a role. A SOAP API can be used to listen to these types of messages. A Time-triggered action can be used as an immediate action or a time-triggered action that has already been triggered is visible in the Time-Based Workflow Queues.
Workflow users can also be set by administrators. These are the people who are visible after a rule has been triggered, even if the rule’s trigger is inactive.
- It is not possible to add time trigger actions to active Salesforce workflows. To add a time trigger action first deactivate the workflow rule then add an action.
- Action taken by workflow rules can also trigger the execution of other workflow rules.