Free Salesforce Admin Tutorial >

Chapter 9 - Process Automation >

Workflows in Salesforce

Workflows in Salesforce

What You’ll Learn


S2 Labs

What Is Workflow Rules In Salesforce?

Workflow is a Salesforce platform business logic engine that allows defining rules to automate certain actions when particular criteria are met.

Note:

Starting in Winter ’23, Salesforce is blocking the creation of workflow rules. You can still activate, deactivate, and edit any existing workflow rules. To test and create workflow rules for use in managed packages, developer orgs still allow you to create workflow rules. For new automation, use flows.

Salesforce Workflow Rules Components 

Workflow rules are considered as a container that consists of two components:

1. Criteria

It consists of the condition which if found true then the actions should take place.

2. Actions

It consists of the actions that should be performed when the criteria for workflow rule are met.

Every Workflow rule must be based on a single object because when a rule is defined this object influences the fields that will be available to set the criteria.

Evaluation Criteria For Workflows

There are 3 types of evaluation criteria for workflows:

Evaluate the rule when a record is

 Description

Created  Runs the rule if the rule criteria are met, only when a record is created. 

 Using this option the rule runs single time only.

Created & Every time it is edited  Runs the rule if the criteria are met every time a record is created and edited. With this option, the rule criteria run repeatedly as long as the rule criteria are met.

 Note: Time-Dependent actions cannot be added to a workflow rule with this evaluation criteria.

Created and Every time it’s edited to subsequently meet the criteria  Runs the rule if the criteria are met:

  1. Always when a record is created and meets the criteria.
  2. Only when a record not meeting the criteria is updated and now it meets the criteria. (As Explained in Class/Video)

 By default, these criteria are selected.

Criteria for rules can be represented as a condition or a formula.

salesforce admin training

Actions In Workflow Rules

Actions in workflow rules are of 2 types based on when they are executed:

1. Immediate Actions

These actions are executed immediately when the criteria for a rule are met.

2. Time-Triggered Actions

These actions execute at a specific time which is specified when creating this type of action. In these types of actions when the date or time comes on which the action needs to be executed, it again verifies whether the record is still meeting the criteria or not. If yes then it executes the respective action otherwise not.

Types Of Actions Available In Workflow Rule

There are 4 actions specified in a Workflow Rule:

1. Email Alert

It sends automated emails using an email template. Salesforce provides functionality to create email templates that can be used to send emails.

There are 4 types of Classic Email templates:

  1. Text: All users can create or change text email templates.
  2. HTML with Classic letterhead: Administrators and Users with “Edit HTML Templates” permission can create HTML email templates based on a letterhead
  3. Custom HTML: Administrators and users with “Edit HTML Templates” permission can create HTML email templates without using a letterhead.   
  4.  Visualforce: Administrators & Developers can create templates using Visualforce. Visualforce email templates allow for advanced merging with a recipient’s data where the content of a template can contain information from multiple records.

Email templates are stored in folders. There are 2 folders already present in every Salesforce org:

  1. Unified public Email Templates: Email Templates in this folder are available to every user in the organization.
  2. My Email Templates: This folder stores the email templates which are used personally by a particular user.
Note:

If another object’s field is added in an email template then it will be left blank as workflow only has access to the object for which it is applied.

2. Field Update

Field updates allow the user to automatically change a field value on the record that initially triggered the workflow rule.

If “Re-evaluate Workflow Rules after Field Change” is enabled for a field update action then Salesforce re-evaluates all workflow rules on the object if the field update results in a change to the value of the field.
Only workflow rules that didn’t fire before will be retriggered.

Cross Object field updates are also available for changing the values of fields on a related master record. But it is not available when re-evaluation is checked.

3. Tasks

It simply assigns a task to a single user, owner, or role. We can also make sure that a notification email is sent to the assignee when a task is automatically assigned.

Tasks should be assigned to roles if they have only one user assigned to that role. If there is more than one user assigned to that role then the task automatically gets assigned to the owner of the workflow rule. (Users who triggered the workflow rule)

4. Outbound Message

An outbound message sends particular information to a designated endpoint such as an external service. These types of messages can be listened to using SOAP API. All the above actions can be used as immediate actions as well as time trigger actions.

Time-triggered actions which are already triggered are visible in Time Based Workflow Queues.
Administrators can also set default workflow users. Default Workflow users are the users who will be visible when the user that triggered the rule is not active.

Note: 
  1. Time-trigger actions cannot be added to active workflows. To add a time trigger action first deactivate the workflow rule then add an action.
  2. Another time trigger cannot be added if there is already a time trigger action scheduled for that object and present in the time-based workflow queue.
  3. The action a workflow rule takes can also trigger the execution of another workflow rule.

Salesforce Business Analyst Training

Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Download Now

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners . But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Comments
  • murali 16 Mar, 2023 at 3:51 am

    nice content

Post a Comment

Your email address will not be published. Required fields are marked *