Salesforce Workflow Rules
What is Workflow Rule
A workflow rule is an order created by a Salesforce user to perform an automated action when another condition or series of conditions have taken place. These actions can happen instantly, or they can be set to operate after a certain amount of time.
There are a couple of things that we need to understand while creating the workflow
- Evaluation Criteria
- Rule Criteria
This is the part where we decide when to execute the workflow. It has three options to perform the flow.
Created: whenever we create a record this evaluation criteria will execute.
Created and every time it is edited: The name itself suggests the work nature of this option.it just executes whenever the record is being edited or created based on criteria. The workflow rule will fire every time the record is edited even though the record may have already met the workflow criteria when first created or in a previous edit.
created, and any time it’s edited to subsequently meet criteria: This is a bit confusing compare to the above condition. when a new record is created, or if an existing record is changed from not meeting the rule criteria to meeting the criteria, the workflow rule with fire. Let’s take an example
Example of last evaluation criteria
where the Director wants to be notified when an Opportunity value is > $50,000. Using these criteria, the rule would fire when the Opportunity is created with a value of $60,000 and the Director would get an email notifying him of this Opportunity. Now if the record is changed from a value of $60,000 to $75,000 the rule does not fire again because it has already met the criteria at its initial creation. Now if the reverse happened, and the value went from $60,000 to $40,000 nothing would happen since the record doesn’t meet the criteria for the rule. But, if in another subsequent change, the value increased to $55,000 the criteria would again be met, and since the record didn’t previously meet the criteria during the last change, the rule would again fire and the Director would receive a new alert.
Rule criteria fire once evaluation criteria execute and it matches the condition in the form of logic or formula.
Action is where we perform our end result. There are two types of Action
- Immediate Action
Here we can perform 4 action
- Field Update
- Email alert
- Outbound Message
Immediate actions, like their name suggests, are executed as soon as the workflow rule finishes evaluating the record.
Time-dependent actions are executed at a specific time, such as 10 days before a record’s close date. All the date column will be shown on the time trigger action.
Note: You cannot add new time triggers to an active rule.
So the next question is how to check the scheduled workflow, no worries salesforce has the ability to show all the future schedule process that is Time-bases-workflow in setup.
process Automation setting
There is a process Automation setting. Let’s take an example to understand this if one of the Salesforce users created a time-dependent action and the user is now active then we have to specify one of the users which allow running the time-based action.
Specify a default workflow user. Salesforce recommends choosing a user with system administrator privileges.
Limitation of workflow Rule
- we can not create the other object record from the workflow while evaluation criteria get executed.
- We can not update the parent or child record of the object record in which we add the workflow rules.
- The problem with the workflow rules is the order which means if you have multiple workflows rule in the single object we can not control the ordering of execution.
Considering Points of workflow
- workflow rule can associate with a single object
- we can not create time-dependent action on Created and every time it is edited evaluation criteria.
- Click on the checkbox reevaluate the workflow rules means it will reevaluate all the workflow rules associated with that object.
- In time-dependent action, salesforce reevaluates the criteria. This is because we can update the criteria at any time.
- Time trigger action can not be added to the active workflow.
- we can not add a new time trigger if any record of that object is associated with earlier time-triggered action.