How can you create Salesforce Workflow rules, by following our methods?
A workflow in Salesforce is a great way to automate certain business processes.
Based on the certain criteria, you can create different rules to do a lot of things like send an email, create a task and/or update any field. This blog explains how to set up a workflow rule using Coruscate’s rules as an example.
Basic Workflow Understanding and Fire / Evaluation Criteria :
A workflow is a set of predefined conditions and actions based on those predefined conditions/criteria. A workflow can be created in a simplistic manner with just points and clicks.
A workflow can be called to perform pre-decided action whenever an insert/create or update operation is performed on a particular record within the database of a particular object in Salesforce. There are mainly four parts in the process of setting up a workflow.
- Select the object on which the workflow would fire.
- Evaluation criteria
- Rule Criteria
- Immediate Action / Time dependant action
Three conditions are the fire criteria or what is also known as Evaluation criteria that can be set as explained below:
Evaluate the rule when a record is
Created:
Whenever a new database entry is entered into the selected object, the workflow rule will be evaluated
Created, and every time it’s edited:
Whenever a new database entry is made into the selected object and also whenever there is any modification made to existing records in the database for that object Time dependent workflow action is NOT available with this option of evaluation criteria
Created, and every time it’s edited to meet the criteria subsequently :
Whenever a new data based entry is made into the database of the selected object and also when an existing entry/record which currently doesn’t meet the rule criteria(as in Point 3 above) in the database is edited/modified to eventually meet the criteria.
NOTE: Workflows should not be created on destination objects referred in REPORTING SNAPSHOT (previously known as ANALYTICAL SNAPSHOTS) in Salesforce. If the workflows are created on an object referred to as destination Object in reporting snapshot, then the REPORTING SNAPSHOT will fail.
Whatever is set up in the rule criteria – the workflow actions will be executed only if the rule criteria are satisfied.
There are two ways to set the criteria ()
Run this rule if the:
1. Criteria are met
Based on fields available on the object the user can enter criteria
Example
Sr No. | Field | operator | Value |
1 | Region | Equals | ASIA |
2 | Origin Country | Not Equals | Russia,China |
3 | Company name | Contains | ALPHA |
By default, all conditions and field criteria are mandatory and follow AND connection
1 AND 2 AND 3
However you can mention the Filter logic if you want to have a complex logic
Example : (1 OR 3) AND 2
This means whatever record is committed to the database in Salesforce with create or edit operation – the workflow will run based on the below explanation
If the record submitted is either for a company whose name contains the word ‘alpha’ OR for ‘ASIA’ region AND the corresponding Origin Country is not ‘RUSSIA’ or ‘CHINA’ then the workflow will execute actions.
NOTE: Comma separated values can be given in Values text box to match against multiple values.
Based on the criteria mentioned and filter logic applied, the workflow rule criteria will match or not match
2. Formula Evaluates to True
This is similar to a formula field – the end result of the formula should be either true or false.
Used Case : In case you want to perform an action without any criteria just based on create or edit the event on the database record in the particular object in Salesforce.
You can just mention ‘true’ in the formula editor and hence formula will always evaluate to true without any condition. Subsequent Workflow actions will be executed.
Example formula for the same example as in above section:
IF(AND(OR(Region__c=’ASIA’,CONTAINS(‘ALPHA’,Company_Name__c)),OR(origin_country__c=’RUSSIA’, origin_country__c=’CHINA’)),true,false)
Once Evaluation Criteria and Rule Criteria have been satisfied in the execution of the workflow, then workflow actions are executed:
There are mainly two frames in which Actions are executed:
1. Immediate Workflow Action
2. Time Dependant Workflow Action
1. New Task:
New Entry in the task object is entered which will be related to the record that triggered the execution of the workflow in the first place. You can add multiple information in the task at the time of creation of the task.
Screen would appear similar to below:
2. New Email Alert:
An Email can be fired from the system to designated Email Ids or mail fields of related objects. You need to have a pre-configured Email template in order to create this action.
3. New Field update:
Values in fields can be updated based on criteria – a static value or a value based on formula can be set in the particular field be it Text or Number or Date or Picklist. Only one particular value can be set in a Picklist field. This can be overcome in process Builder.
4. New Out Bound Message:
We can send a message to an External system using this feature. You can mention the endpoint URL and value of fields that you have selected during the creation of this action. This feature has a very rare used case and out of 100, you might find yourself using this feature in hardly 1 workflow.
5. Select Existing Action:
You can select existing actions which were already created earlier or created as a part of another workflow.
If you want the action to happen after or before a particular period of time of the execution of workflow
Example : You want to create a task for the user to send manual Email 2days after the workflow evaluation or after 10 hours you want to set up a follow-up task for the record.
These used cases can be achieved using time-dependent workflow actions.
The tasks and actions submitted to happen in the future can be monitored under the “Time-Based Workflow” section in Setup.
After time trigger is created, then we can add any new or pre-existing workflow action to execute as per the time trigger setup
Discuss with us in comments how have you used the workflows in your business practices?