How to Use Decision Element in Salesforce Flow

The Decision is a very important element in the Salesforce Flow. It allows for the creation of multiple paths based on various criteria, allowing a single flow to output different results based on decision criteria.

In this Salesforce tutorial, we will learn about decision elements in Salesforce Flow, and additionally, we will see how to use decision element in Salesforce Flow with real-time scenarios and step-by-step explanations.

What is the Decision Element in Salesforce Flow?

A Decision is a flow element that allows you to evaluate a set of conditions and route users through the flow based on their outcomes. The element actually performs an if-then statement. When a flow executes a decision element, it evaluates each decision outcome in order.

Let’s take a Scenario while working as a Salesforce Admin for a US-based Organization that provides software solutions. I was assigned the task of developing a flow. Whenever a case is created, I need to create different tasks according to different Case Priorities.

For example, we have Low, Medium, and High priorities. When the case is created, we have to create a task with a due date of 10 days, 5 days, and 2 days, respectively.

How to Use Decision Elements in Salesforce Flow

Using the above scenario and the following steps, we will discuss how to use Decision Elements in Salesforce Flow.

1. Log in to the Salesforce Org. -> Click on the Setup -> Home Tab -> In Quick Find Box, Search for Flows. You will see an option under Process Automation -> Click on Flows.

2. Then, click on the New Flow button to create a new flow.

3. The task will be created when the Case record is created. For that, we have to select the Record-Trigger flow. Then, click on the Create button.

See also  Automatically Assign PricebookId to Opportunities using Salesforce Flow

4. In our scenario, the flow should trigger when we create a Case record. That’s why I have selected the Case in the Object field. In Configure Trigger, I have selected A Record is Created because when we create the record, the flow should trigger.

How to Use Decision Elements in Salesforce Flow

5. Then, we have to Set Entry Conditions, and in the Condition Requirement option, we have to select All Conditions Are Met(AND) because the following condition should meet the criteria.

Here, the flow has to trigger only when the Priority – Is Null – False.

We are going to create a Task according to Case Priority, so we have to select Optimize the Flow for Action and Related Records.

How to Use Decision Elements in Salesforce Flows

6. Now, we need to create a formula to find the Due Date according to Case Priority. In our scenario, we have to create a formula according to the following criteria:

Case PriorityDue Date
LowNext 10 Days
MediumNext 5 Days
HighNext 2 Days

Now, we will create a formula to find the due date for the Low Priority case. We can create the formula using a New Resource. To do that, click Toggle Toolbox and select New Resources. Enter the details to define the new resource.

  • Select the Resource Type as a Formula.
  • Enter the API Name. It will be used as a value in the next step.
  • Enter the Data type as Date.
  • Enter formula – Toady() + 10. This formula will add 10 days to the Created Case record date.
  • At last, click Done.

In the same way, create new resources for Medium and High-priority cases.

Use Decision Elements in Salesforce Flows

7. We have a Decision Element to create different tasks for different priorities. Enter the Label for the decision element. The API Name will populate automatically.

8. Now add Case Priorities as an Outcomes as follows:

See also  How to Display Image in Salesforce Screen Flow

Low: Enter a Label named Low. The Outcom API Name will automatically populate. Then, in the Condition Criteria, we have to add a condition for when we select Low priority then the low priority task should execute.

  1. $Record->Priority – Equals – Low (Picklist Value from Priority).

Similarly, click on the ‘+ Plus icon‘ to add two more outcomes for Medium and High Priority. And then add conditions according to them.

Decision Elements in Salesforce Flow

8. Now, we need to create a task for the case priorities. We are creating a task for low priority. For that, click on the + plus icon below the Low Outcome, and then you will see the Action Element.

Use of Decision Elements in Salesforce Flow

9. As you click on it, you need to add action in the Action field. To create a task, we have to select the New Task action. Then, enter the Label, and the API Name will automatically populate. The description is optional; you can give a short intro about this Action element.

Create Salesforce Using Decision Element

10. We have to Set Field Values for the Selected Action. The following input values will display on the Task object as fields on the Detail Page.

  • Assigned to ID: We need to select the user to whom this task will be assigned. I have assigned the same user as the owner of the Case object Record.
  • Due Date Only: Here, we need to select Formula, which we created in New Resources. You can see I have selected Due_Date_Low_Priority, which is the API Name of the created formula.
  • Name ID: If we need to associate a task record with a contact or lead object, we need to provide a Name ID. Here, I have associated task records with the ContactId.
  • Related Record ID: Here, we can relate the task record to the parent record.
  • Subject: Then I have entered a hardcore subject, which will display on the Task activity.
See also  How to Call Approval Process From Flow in Salesforce

After that, click on the Done button.

How to Use Decision Element in Salesforce Flow

Similarly, we have to add Task Element for Medium and High Priority, and in that, we need to change the Due Date and Subject. And assign particular fields to them.

You can read the whole article on How to Create a Task Using Flow in Salesforce.

11. After that, first save the flow. You can see the Save button. Click on it and then click on the Debug button. Then click on the Activate button; always remember to debug the flow before activating it. It’s good practice to use flow.

How to Use Decision Element in Salesforce Flows

12. After Activating the flow, I created a New Case with High Priority. We will see whether the Task is created with a Due Date in the next 2 days.

Create Salesforce Flow Using Decision Element

13. As you navigate to Task Object you will see New Task is created. Here, today’s date is 22/04, and the Due Date is 24/04, which means in the next 2 days.

How to use the Decision Element in Salesforce Flow

This is how we can use Decision Element in Salesforce Flow.


I hope you have an idea about what a Decision element in Salesforce is. We have also seen how to use a decision element in Salesforce Flow with real-time scenarios and step-by-step explanations.

You may like to read: