Workflow Rule in Salesforce:
Workflow rules is an automation tool in Salesforce that offers time-saving solutions for making different internal processes of a company switch from manual work and for optimizing various procedures.
Workflow in Salesforce is basically a container or business logic engine which automates certain actions based on particular criteria. If the criteria are met, the actions get executed. When they are not met, records will get saved but no action will get executed.
Components of Workflow in Salesforce:
Workflow rules in Salesforce can be broken down into two main components:
- Criteria:
Criteria are conditions you are supposed to put in order to test a record. For example, if you’re from a technical background, what the if statement does in an if/then the condition is what criteria mean in a workflow. - Actions:
Actions occur after a record meets the criteria. Again, what the then statement does in the if/then the condition is what an action means in the workflow.
Types of actions present in a workflow in Salesforce:
- Immediate actions:
Actions that get executed immediately when a record is created or edited - Time-dependent actions:
Actions that get executed after a certain duration of time.
Types of evaluation criteria:
- Created:
Whenever a record is created and the criteria match with the record, the action is executed. - Created and edited it:
Whenever a record is created or updated, the action will be executed. - Created and every time it’s edited to subsequently meet the criteria:
Whenever a record is created and it stands true to the criteria, the action will be performed. Now, if the record is edited and it doesn’t meet the criteria, the action will not be performed.
Suppose, the created record doesn’t meet the criteria, and then it is edited or updated to meet the criteria. It will be evaluated again and, if it meets the criteria, the action will be performed. Otherwise, it won’t be performed.
Types of Workflow actions:
- Task – Assign a Task.
- Email Alert – Send an Email.
- Field update – Update a Field.
- Outbound message – Send an Outbound message.
Workflow Limits:
The immediate actions and each time trigger can have:
- 10 email alerts
- 10 tasks
- 10 field updates
- 10 outbound messages
- 10 flow triggers
# How can we count the total number of workflow rules in our org.
Counting one by one manually is a time consuming process if there are more rules! Solution is using a simple SOQL query we can get the total workflow count.
- Go to Salesforce org
- Click on Gear Icon (Dropdown menu)
- Click on Developer Console
- In the Developer Console, click the Query Editor tab.
- Copy and paste the following SOQL Code line into the first box under Query Editor, and then click Execute.
1. To get the overall workflow rule count in the org, use
SELECT count(Id), TableEnumOrId FROM WorkflowRule Group by TableEnumOrId
2. To get the workflow rule count for any sObject. Let's say for account object use
SELECT count(Id), TableEnumOrId FROM WorkflowRule WHERE TableEnumOrId = 'account' Group by TableEnumOrId
## Don't forget to check the 'Use Tooling API' checkbox next to Execute.
Note:
By default, each object is limited to 50 active workflow rules. Total workflow rules per object is 500.
Resources:
- Video Tutorial : Creating a Workflow Rule (Salesforce Classic)
- Video Tutorial : Automation: Workflow Rules and Approval Processes
- Set the Criteria for Your Workflow Rule
- Some Workflow Rule Examples
- Trailhead Module
Comments
Post a Comment