What is a Workflow Rule?
Workflow rule can be defined as an automated mechanism in Salesforce by which we can perform 4 types of actions when a record is created or edited and make our business automated without writing any code.
Criteria in Workflow Rules
- Created - It evaluates the criteria whenever a new record is created means when the rule criteria are met then the workflow action will be performed upon the creation of the new record.
- Created, and every time it’s edited - It evaluates the criteria whenever a new record is created or edited. If the rule criteria are met then the workflow action will be performed upon creating or updating of record.
- Created, and any time it’s edited to meet criteria - It evaluates the criteria whenever a new record is created or edited. The workflow rule will run for the new record when the rule criteria are met. When we want to update a record, the workflow rule will run only when the record goes from not meeting workflow rule criteria to meeting the criteria.
Don't forget to check out: Deploying Workflows Through Change Set | The Salesforce Developer Guide
Types of Actions in Workflow Rules
Following are the actions that we can perform using workflow rules:-
We can update a field in a record using field update action whenever the workflow rule criteria are met. The only limitation is that we cannot update fields on another object. We can only update the field of the same object on which the workflow rule is created.
To overcome this limitation we can use process builders and flow builders.
We can use this action to give automated work to another user in the company. This helps to get rid of paper tasks/paperwork/manual processes. The receiver can update the task with status which the manager can easily check using the activities section on the right-hand side in the record page. We can create tasks for only users and roles.
By using this action we can automatically send emails to our business users. But we need to be ready with email templates. We can create 4 types of email templates in Salesforce i.e Text, HTML, Custom and Visualforce. We can send only 1000 emails per Salesforce standard user license and 200000 emails per organization.
This is a feature in workflow rules by which we can connect the Salesforce platform to other external platforms like .Net, Java without any code. This works as a workflow rule action so it will work when any record is created or updated.
Time-Dependent Workflow Rule Actions
There are some situations in which we don't want to execute the action immediately, We want that to happen after 1hr or 6hr or 10 days etc. In such cases, we use time-dependent actions. This action works only in hours and days format, not minutes.