How to Run a Flow from a List View in 8 Steps

newsletter Feb 17, 2024

This week a client of mine asked me to build a custom button on a list view in order to trigger a Flow.

Have you ever needed something like that?

Here are 8 steps that will show you how to trigger a Flow for every record in a list view, all from an easy to click button.

Step 1: Identify your use case.

To keep it simple, we'll pretend we need a Flow to create an Opportunity for any Account where the Upsell Opportunity field is "Maybe" or "Yes".

Step 2: Choose your flow type.

This process works for Screen Flows and Auto-Launched Flows.

The main decision is if your use case requires showing a screen to your end users.

In this case, it does not, so we'll choose Autolaunched Flow.

Step 3: This is one of the most important steps.

Immediately in the Flow Builder:

  1. Create a variable
  2. Set the text data type
  3. Mark the variable as a collection
  4. Mark the variable as available for input
  5. Name it exactly "ids"

Note: it must be exactly "ids"

The variable name is case sensitive.

Salesforce "knows" to pass the record Ids of all the records from your list view into this variable when you click the button.

If you do this step wrong, the button won't work!

Step 4: Build out your flow. Then save and activate it.

I'll skip the nitty gritty here but in our example, the Flow is designed to create an Opportunity for each Account we select, based on the Upsell Opportunity field.

The critical thing to know when building your flow is that is must be bulkified.

Your flow will run on every record you select in your list view.

Therefore, it must be able to successfully run for dozens (and maybe hundreds) of records at once.

Step 5: Find the Flow URL.

Exit the Flow you just built and go to the Flow Builder.

Find the Flow in the list and click the dropdown on the far right. Select "View Details and Versions"

From the Details page find the URL field.

Copy the value in that field to your clip board or into a note document.

You'll need it in Step 6.

Step 6: Build your button.

Navigate to the object in the object manager with the list view you want the button to be on.

In our example, we want our button to be on the Account list view, so we'll go to Accounts in the object manager.

Click Buttons, Links, and Actions on the left.

Then click New Button or Link on the right. 

Name your button.

Select List Button for the Display Type.

And then paste the URL you copied from Step 5 into the field below.

Then press Save.

Step 7: Add the button to the list view.

Click List View Button Layout.

Click edit.

From here, uncheck the boxes to remove Standard buttons you don't want.

Then move the button you created in Step 6 from the Available Buttons column to the Selected Buttons column.

Press Save.

Whew! You're done.

Let's go check it out on the list view.

Step 8: Test everything out.

Refresh your List View page and confirm your button is visible.

Select a few records from the list you want to run the Flow for.

Once you check the box next to the records, click your button.

Confirm the Flow runs as expected by spot checking some records.

In this case the new Opportunities.

Looks great! Everything came out as expected!

I followed these steps for my client this week and was able to get everything working.

Thought it might be helpful at some point for you too!

 

Best,

Nick

 

 

Salesforce Made Simple

Join the Salesforce Saturday newsletter. Every Saturday, you'll get 1 actionable tip on Salesforce technology or career growth related to the Salesforce Industry.

We hate SPAM. We will never sell your information, for any reason.