Declarative Tools for Automation Workflow Rules – Salesforce Admin Tutorial
Basically, there are three major tools by which we can automate the system by clicks and configurations:
- Workflow Rules
- Process Builder
Before we move ahead into its details, we need to understand why and when we need these tools. These declarative tools let you automate internal procedures and processes in a great way by just point and clicks that saves a lot of time and can be easily handled by Administrators thereby reducing the dependencies on Salesforce developers. In this topic, we will discuss Workflow Rules and its related details .
A workflow run the show is the most holder for a set of workflow enlightening. It is one of the automation tools which allows you to define rules and perform actions. Workflow rules are considered as a holder that comprises of two components:
- Criteria – It consists of the condition which must be met before the actions should take place.
- Actions – It consists of the actions that should be performed when the criteria for the workflow rule are met.
Every workflow is defined on one object and the respective fields of that objects are available to be used for the criteria and actions. There are three different types of evaluation criteria that can be defined in workflow rules:
|1.Created||Runs the rule only if the record is created. Using this criterion, the rule will run single time only|
|2. Created and every time it’s edited||Runs the rule if the record is created and edited to meet the criteria every time. This rule will run recursively if the criteria is met on edit.|
|3. Created and every time it’s edited to subsequently meet the criteria||Runs the rule if the criteria are met on creation or update but if the record is not meeting the criteria and on update it is meeting then it will run. By default, this criterion is selected|
There are two types of actions that we can define in workflow rules based on when they are executed:
- Immediate Actions
- Time triggered Actions
The actions which are executed immediately as soon as the workflow criteria is met are known as Immediate actions.
Time triggered Actions
The actions which will execute at the specified time which is defined while creating the actions. In these types of actions at the specified date and time at which the action needs to be executed, it re-verifies whether the record is still meeting the criteria. In case yes, at that point it executes the individual activity otherwise not.
There are 4 types of actions that we can define in workflow rules:
- Email Alert
- Field Update
- Outbound Message
We can send emails to the users using email alerts using email templates. We can either define the email and user fields for the recipient column or we can specify static email addresses. Example:
Columns marked with red bars are required to define while creating email alerts. In the column named “From Email Address”, we can select what should be the from address for sending the email. We can choose either the current user’s address or we can create an Organisation-Wide Email address to use it.
We can update the fields of the object for which we have created the workflow rule. We can also use formulas to update the field on the basis of some conditions but that is also dependent on the type of the field which we need to update. In the screenshot we can see the different parameters that can be used for creating the field update.
In the above image we chose picklist field to update so it is showing only those values which are defined for that picklist (therefore, no formula can be used). Highlighted box checkbox can be used to re-run the workflow after field update if it is checked. Below is the example screenshot of a valid text field to update for which formula can be defined.
It essentially allots a task to a single user, owner, or a role. Also, an email notification is sent to the assignee when a task is automatically assigned. We can set the status, priority, and due date for the task. Below image shows the parameters required for creating the task under workflow rule:
An outbound message sends information to a designated endpoint API. We need to define the endpoint and the fields that we need to send from salesforce to the external system. We can also define if we need to send the Session ID or not. Following are the steps to create outbound messages:
- Click on Setup.
- In the Quick Find box enter “Outbound Messages”.
- Click on the New Outbound Message button.
- Select the needed object.
- Define the required parameters (Name, Endpoint, and fields).
- Click Save.
All these actions can be used for immediate and time triggered actions.
- If the workflow rule is already activated, we can not add new time triggered action to that workflow rule. We need to deactivate it to add the new action.
- To monitor the time based actions, we can navigate to “Time-Based Workflow Queue” in setup.
- The action a workflow rule takes can also trigger the execution of other workflow rules