Workflow Rule is the container for the automated process. It has two main parts; Workflow Rule Details and Workflow Actions.
1. Workflow Rule Details
Workflow rules are related to a specific object and you must select the object when you create the rule. After the creation, you cannot change the related object of your workflow rule. Like all the other processes, you must give a unique name to your workflow rule.
1.1. Evaluation Criteria
Evaluation criteria has three options:
- Created: Workflow rule is evaluated when the record is created.
- Created, and every time it’s edited: Workflow rule is evaluated whenever the record is created or edited.
- Created, and any time it’s edited to subsequently meet criteria: Workflow rule is evaluated when a record is created, and when a record that doesn’t meet criteria is edited to meet criteria.
It is important to understand the difference between the second and third option.
1.2. Rule Criteria
It is the condition that runs this workflow rule. Choose “criteria are met” to select the fields and their values, and put the condition logic. Choose “formula evaluates to true” to write a formula for the condition that runs the rule. There you can insert fields, custom labels, custom settings (hierarchy type), current user, user role, user profile, operators and functions to build your formula.
2. Workflow Actions
Workflow actions can be divided to Immediate Workflow Actions and Time-Dependent Workflow Actions. In both cases, options are to create a task, update a field, send an email alert and send an outbound message. You can create these actions directly from your workflow rule, or you can select an action that you have already created.
If you enter your actions under Immediate Workflow Actions, workflow rule will run these actions immediately. If you want your workflow rule to run the actions on a specific time or after some time, you must put these actions under Time-Dependent Workflow Actions.
2.1. Time-Dependent Workflow Actions
First of all, you have to add a time trigger to specify when to run the actions. You cannot add a time trigger to an active workflow rule, so you will need to deactivate your workflow rule first. Also, you cannot add time-dependent workflow actions if your evaluation criteria is “Created, and any time it’s edited”. Otherwise, you can specify up to 10 time triggers per workflow rule.
You can enter the number of hours/days before/after a date or date/time field. If you want to run the actions on a specific time rather than using hours/days after, you have to save this date/time in a custom date/time field and then create the time trigger as 0 hours after this field.
After adding the time trigger, you can add the workflow actions under it.
When Salesforce triggers a workflow rule, its time-dependent actions are placed in the workflow queue. You can check the queue for time-based actions from Time-Based Workflow under Monitoring in setup. If there are records in queue, you cannot change the time trigger of the workflow rule. To do so, you must remove these records from the queue.