How to Use Salesforce Flow in List View

In Salesforce, we can launch a flow from List View instead of going from one tab to another.

In this Salesforce tutorial, we will learn to use Salesforce flow from list view, and we will also see how to use Salesforce flow in list view using real-time scenarios and step-by-step explanations.

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 the user wanted to close multiple cases by selecting multiple cases in a single click from the List View.

Here, we can use Autolaunch Flow, and we can apply flow to the list view using the button.

How to Use Salesforce Flow From List View

Using the above scenario and the following steps, we can use Salesforce Flow from the list view.

1. Log in to 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.

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

2. Here, we will select Autoaunched Flow.

Now, we will create the following elements in the flow according to the flow diagram displayed in the following Flow Diagram.

How to Use Salesforce Flow From List Views example

1. New Resource(ids):

3. Before creating a flow, we need a variable to fetch the records, so we are going to create a new variable.

4. For that, click on the New Resource and then select the Resource Type as Variable. Enter API Name. Here, I have entered ids because this is the Standard Variable; you need to provide a label as it is to fetch the selected records from a List View.

Select Data Type as Text and Allow multiple values(Collection). Check as Available for Input and click on Done.

How to Use Salesforce Flow From List Views

2. Get Records(Fetch Case Records):

5. Then, we need to fetch the all Case Records. For that, we need to select the Get Records element and enter a Label and API Name into it.

See also  How to Use Decision Element in Salesforce Flow

In the Object field, select the Case object. To fetch the records, we need to add a condition. Here you can see I have applied the following conditions:

  • In the field, select CaseID, use the IN operator, and select created ID available ids.
  • Then Status – Does Not Equal Closed.” Because we need to close only those cases whose status is Opened.

Then in How many records to store, here we are going to store All Records. After this, leave the other fields as they are and click on the Done button.

How to Use Salesforce Flow From List View

3. Decision (Check Null Records):

6. Here, We need a Decision element to check whether the records we are fetching are Null or Have values. When you click on the Decision element from the add element, you need to enter the following necessary details.

Here, we need to enter the element Label, which displays on Flow Canvas. The API Name will automatically populate. It will be used to back functionality.

7. Then, we need to define two Outcomes: the first is Not Null, and the other is Null.

  • Not Null: In the not null outcome, we need to add a condition that the records we got from the case should not be null. The condition will be Get Records(API Name) – Is Null – False.
  • Null: There is no need to add any condition here; only change the Label of the Default Outcome to Null.
Use Salesforce Flow From List View

4. Loop Element(CaseObj):

8. Now, for the Not Null part, we will use the loop element to iterate the records. To add the Loop Element, click on the Add Element icon. Then, enter the element Label and API Name.

Then, select the Collection Variable from Get Records(API Name) and select the iteration direction from the first item to the last item.

Then click on the Done button.

Use Salesforce Flow From List Views
How to Use Salesforce Flow From List Views examples

5. Assignment(Change Case Status):

9. Now, we are going to assign close value to the records whose status is open. For that, add the Assignment Element under the Logic Component and click on the Add Element icon. Then, enter the element Label and API Name.

See also  How to Create Lookup field in a Salesforce Flow

Then, in the Set Variable Values for that variable field, select Current Record – Equal“Closed.” In the variable field, we have to select the Loop element record.

Create and Use Salesforce Flow From List View

6. New Resource(Changed Cases Collector):

10. To store the cases, we need to create a new variable. To do that, click on New Resource and then select the Resource Type as Variable. Enter API Name. Here, I have entered Changed Cases Collector.

Select Data Type as Record and Allow multiple values(Collection). Then select Object as Case. We will store all changed case records in this variable. Click on Done.

How to Use Salesforce Flow From List View example

7. Assignment(Store Changed Cases):

11. Now, we need to add one more Assignment Element to store all changed case records. I have labeled it Store Changed Cases.

Select the Variable we created in the above step(ChangedCaseCollector), select the Add operator, and pass the value CaseObj. This means we are storing the current variable in ChangedCaseCollector.

Use Salesforce Flow From List Views example

8. Update Records(Update Changed Cases):

12. Always use the Update Record element outside of the Loop element because if we use it inside the loop, it will break the Governor Limit.

Enter Label and API Name then use the IDs and all field values from a record or record collection. Here, we have a Record Collection Variable where we have stored all changed case status records.

In selecting Record(s) to Upfate, we will use ChangedCaseCollector to update all records.

How can Use Salesforce Flow From List View

9. Save Flow:

13. 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 Use flow in List View; the API Name will automatically populate as we click the text box. The Description is optional; we can introduce our flow Shortly.

10. Debug & Activate:

14. After Saving the flow, 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.

See also  Automate Birthday or Anniversary Email Using Salesforce Flow

11. Apply Flow on List View:

15. Now go back to the Flow list, select the flow that we have created, click on the dropdown arrow, and click on View Details and Version.

How to Use Salesforce Flow From List View examples

16. Then copy the URL; this needs to create the List View button on the Case Object.

Apply Salesforce Flow on List View

17. Then, we need to create a button using this URL and go to Object Manager -> Case -> Button Links And Actions.

Enter Label and Name will automatically populate, then in the Display Type, select List Button, and in the Content Source, select URL. After that paste copied URL in the Editor window.

Save the button.

Apply Salesforce Flow on List View example

18. Then, we need to add a create button to the list view. To do that, click on the List View Button Layout. From here, we can add a created button to the List View.

Again, go to the Case Object, and you will see that the Change Status button has been added to the case list view. Now select the Opened cases that you want to Close.

After selecting the case record, click on the Change Status button. Then, you will see Your Flow Finished Message.

Change Case Status From List View

19. Then again, go to the case object, and you will find the cases you selected to change the status that has been successfully changed to Closed.

Changed Cases From List View Using Flow

This is how we can use Salesforce Flow from the list view.

Conclusion

I hope you have gotten an idea about auto-launch flow. We have seen how to use Salesforce flow from list view using real-time scenarios and step-by-step explanations.

You may like to read: