How to Create a Task Using Flow in Salesforce

In Salesforce, with the help of flows, we can automate users’ tasks and activities, which results in efficiency in managing the same in the Org.

In this Salesforce tutorial, we will learn How to Create a Task Using Flow in Salesforce with real-time scenarios and explanations.

Task Using Flow in Salesforce

What is the use of a task in Salesforce Flow?

In Salesforce, we can use flow to automate the process of creating tasks for a particular record. The task created with the help of a record trigger flow will notify the user regarding the task details to work on it, and here, we will learn how to create a task using flow in Salesforce.

We can create a task using the following two methods:

  • Using Action Element: Here, we will get a predefined task object field to map with the Account fields.
  • Using Create Record Element: Here, we need to specify task fields and map them to the account account fields.

Limitation for using Action Element:

  • Using the action element, we can add only a few fields in task records that are predefined in Salesforce Flow.
  • We can add extra fields to the Create Record element that we cannot add to the Action element.

Scenario:

While working as a Salesforce Admin for a US-based Organization that provides software solutions, I was assigned the task of creating a task that, whenever an Account is created with revenue more than 1 lakh, we need to notify the user that this is a high-potential client, and you need to follow up with the primary contact for that particular Account.

Pre-requisite: We need a lookup relationship field on an Account object related to the Contact object with the Primary Account field name.

How to Create a Task Using Flow in Salesforce

Using the above scenario and the following steps, we can create a task using Salesforce Flow.

Create Task Using Action Element:

First, we will see using an action element how can create a task 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.

Create a Task Using Salesforce Flow

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

Create a New Task Using Salesforce Flow

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

Create Task Using Salesforce Flow

4. In our scenario, the flow should trigger when we create an Account record. That’s why I have selected the Account 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 Create a New Task Using 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 following both conditions should meet the criteria.

See also  Two Ways to Post to Chatter Using Salesforce Flow

Here, the flow has to trigger only when the AnnualRevenue is> 100000 and the Primary Contact field is not Null.

How to Create a Task Using Salesforce Flow

6. Then we need to select Every time a record is updated and meets the condition requirements: When you select this option, every time you update the record, the flow will trigger.

We are going to create a related record and want to link that record to the Account and Contact, so we have to select Optimize the Flow for Action and Related Records.

Create a Task Using Salesforce Flows

7. Now, we are creating the task using Action Element. To add an action element, click on the + plus icon, and then you will see the Action Element. Then click on the All category.

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.

How to Create a Task Using Salesforce Flows

8. 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: In this field, we can assign a user to the created Task record. Here, I have assigned the same user as the owner of the Account object Record.
  • Due Date Only: I have created the formula variable for the next day and used that formula here.
  • Name ID: If we need to relate a task record with a contact or lead object, then we need to provide a Name ID. Here, I have related task records to the Primary Contact.
  • 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.

After that, click on the Done button.

How to Create Task Using Salesforce Flow

9. 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.

Salesforce Flow to create new tasks

10. After that, I created an Account with more than 1 Lakh revenue and saved that record. As I saved the Account record, the flow triggered, and a Task was created with the details that we had entered in Set Field Values for the Selected Action.

Create a Salesforce Flow to create new task

This is how we can create a task using Action Element in Salesforce Flow.

See also  Automatically Add Users to Public Group Using Salesforce Flow

Create Task Using Create Record Element:

Now we will see using the create record element how can create a task in the Salesforce Flow.

1. The Create Record element we will add to an existing flow that we have created for the Action element.

Now, we are going to create a task using the Create Record Element. To do that, click on the Add Element icon. Under the Data component, you can see Create Record. Click on it.

Create Task using Create Record Element in Salesforce Flow

2. When we click on Create Records, we enter the Label, which will display on the flow canvas. The API Name will automatically populate. The description is optional.

Then, we will create only one record at a time, using Separate resources and literal values because we will not use all values to create a Task record.

Create a Task using Create Record Element in Salesforce Flow

3. Now, we have Set Values for the Task. We need to assign values to the task object just like we have assigned in the Action element, but you will notice that we have more fields here than in the Action element. This is the advantage of the Create Record element.

Here, on the left side, we can see the Task object Fields, and on the right side are the Values that we will provide from the Account object or other resources. The following input values will display on the Task object as fields on the Detail Page.

  • OwnerID: We have assigned the Account Owner ID to this field because I have assigned the Account Owner to the Task record owner.
  • ActivityDate: This is the due date that this task should be completed before the Due date.
  • WhoID: The Who ID basically refers to the person, such as the lead or contact. Here, we have a lookup relationship with the Primary Contact, so we have assigned this to the Who ID.
  • WhatID: What id refers to the other than a person, so here we have assigned the parent record of the Task object.
  • Subject: Then I have entered a hardcore subject, which will display on the Task activity.
  • Description: Here, we can write any message as a description.
  • Priority: We can set default Priority from the set field value.
Create a New Task using Create Record Element in Salesforce Flow

4. After setting up all labels and conditions, click the Save button to save the flow. For that, we need to enter the Flow Label; here, I have entered the create a task using flow. The API Name will automatically populate as we click the text box. The Description is optional; we can introduce our flow Shortly.

Salesforce Flow to create new task

5. We added the Create Record element to the same Action element flow and Activated it. Now, we will check how it will work in the Account Record and how we will create the Task Records.

How to Create a New Task using Create Record Element in Salesforce Flow

6. Here, you can see that I created an Account record with the triggering conditions, and when the flow is triggered, the two tasks are created: the first from the Action Element and the second from the Create Record Element.

See also  How to Upload Files Using Screen Flow in Salesforce 

Here, you can see on the second task we have a Red Flag. This will be possible from the create record element. We cannot use this in the action element. Now, I will show you the Task Details record that we have created from the Create record element.

How to Create Task using Create Record Element in Salesforce Flow

7. Here, you can see we have extra fields with comments as Description rather than the Action element.

How to Create a Task using Create Record Element in Salesforce Flow

This is how we can create a task using a Create Record element in Salesforce Flow.

Conclusion

In this article, we have learned about Tasks and activities. I hope you have an idea about creating a task using flow in Salesforce.

Here, we have seen what a task is, different methods to creating a task in Salesforce flow, its limitations, and how to create a task using a Salesforce flow with the scenario and step-by-step explanation.

You may like to read: