“How do I submit multiple records into my process?”

This sounds like an obvious job for Flow and a List Custom Button, right? We open the list view, tick a few checkboxes, click the list button… but quickly find the Selected Record IDs are nowhere to be found in Flow.

There are a few workarounds to inject the checked rows:

  • Use code or a package to run the flow as a batch process
  • Add a custom field and use mass edits to invoke process builder
  • Create a VF page with apex:interview to inject the selected records
  • Use GETRECORDIDS in a JavaScript custom button (alarm bells ringing…)

Here’s an easier way to access Selected Record IDs

After clicking multiple checkboxes in any list view, the selected records are accessible – the key is to launch the Flow using its URL in the button content:

Then, configure the ‘Nudge Owner’ flow so the posted IDs are received:

  1. Create a new Collection Variable resource
  2. Enter the Unique Name called ids
  3. Set the Type to Input Only

When configured correctly, Salesforce automatically populates the collection variable with the IDs of the selected checkboxes. Now we can loop over the collection variable and perform business logic.


  • This parameter isn’t documented anywhere.
  • The name of the ids collection variable is case sensitive.
  • Remember to “close the loop” otherwise only the first ID is handled by Flow.

The same technique works on Detail Page Buttons: if an id variable exists in the flow, it is automatically populated with the current Record ID context. For want of a better term, these “standard parameters” act the same as standard controllers:

Mass flow actions can be bulkified too, they need not be limited by iterations of the loop element. Plugins using the @InvocableMethod annotation do support collection variables – the ids list can be passed straight in.

Benefits of standard flow parameters

Standard flow parameters eliminate the need for Visualforce Pages to arrange input records. They behave like an interface contract. ISVs can automatically deploy surgical, self-contained customizations more easily with the Metadata API. Further:

  • Avoiding the VF page also avoids any need to modify Profiles.
  • Using URL custom buttons avoids hard dependencies on packaged Flows.
  • Documentation isn’t required to explain how to set context sensitive inputs.

True, distributing flows using Visualforce Pages offers more granular access control since the entry point is restricted by its associated page – this is applicable in sites and communities or portals.

Otherwise, any reason not to do this?

Update: vote for official support! Idea: support standard id/ids flow variables

Related Posts

Last modified: 14th August 2019


Renato Oliveira 

Since it is not documented then we have no guarantee that this won’t real in a platform update. That’s a more or less good reason in my opinion.

Bruce Stewart 

Can you provide detail on your “Assign Next” node? I believe I have “closed my loop” but do have my flow operating on only 1 of the “ids” after looping through them. Thank you!

    Hi Bruce, the node “Assign” is a do-nothing that sets the id variable to empty string. If that doesn’t work, try eliminating it altogether and drawing the output from the email straight back to the loop element (it will display as a connector with an arrow on both ends)

Jeffrey Kranz 

Interesting to learn about the ids collection variable!
I will add that for a single record from a record detail page, using “recordId” is the documented and supported way to get the record ID

Natalya Murphy 

I attempted to do this but the flow got hung up any time I clicked the button after selecting records.

    Hi Natalya, try setting the behaviour to “Display in existing window without sidebar or header”

    Natalya Murphy 

    Thanks for figuring that out. I’ve confirmed it works when the display is set to Display in existing window without sidebar or header.

Petr Novotny 

WOW that works even in lightning – THANK YOU VERY MUCH !

Alexander Twomey-McLeod 

Why when I do this does it pass ALL the records for that object and not the selected ones? Cannot figure it out

    Simon Kinder 

    seems to pass every single items id rather than checked ones? did this get changed

Lee Anne Galasso 

This is just not working for my custom object. I’m getting: “Unable to set value for variable ‘ids’. Flow encountered an error when processing and converting between data types. Please check the flow and ensure all data types are matched correctly.” when I start the flow from the button.

    Kylie Harrison 

    This seemed like a great solution for me, but I have tried to get this to work in 2 separate screens and it does not work for custom objects, unfortunately. When I run it on custom objects and direct to a flow all I get is white screen and nothing in the debug log. Just in case I tried a 2nd built flow to take the ids and same story.

    Banzai Admin 

    Lee Anne I had this error as well. I changed the ids from an sObject collection variable to just a Collection Variable, and it worked great. I wish this hack worked with sobjects as that would save a ton of steps in certain use cases. Also, I’m using it on a custom object as well.

    Lee Anne Galasso 

    Banzai Admin, thanks for the tip, but I have no idea how to use a non-record Collection variable. I’m assuming you created a text collection variable. But then, how did you use that collection variable to find the records you were looking for?

    Tyson Kirksey 

    This is exactly what I need, but I can’t get it to work with Opportunities in Lightning. I get the same error as Lee Anne. Any ideas?

Nino Morales 

Still works for me! You are genius for this!!

Keerthana Pachalla 

This works great in lightning but cannot get it to work in communities. Any ideas?!

Hi, I am receiving the same message as above “error when processing and converting between data types”.
If this can work on custom objects, as Banzai Admin, reports, then how should the ids variable be set up as a Collection Variable, instead of an sObject collection variable?

    Hi J, the collection variable called “ids” should be of type ID or Text. Can you try creating a Screen Flow and URL button like this? It works OK in the new flow builder too.


    Yaakov Singer 


    So, first of all, it’s working … in general. I needed to activate the latest version. Oops! The ids are being collected. That’s the key step.

    Thank you!

Vinod Kumar 

I’m using Lightning flow to create multiple accounts, all these records are stored in a ‘List’ aura attribute. In Flow I have created a Account Collection variable to store all accounts. But I am not able to send the list from component to flow.

var inputVariables = [{
    name : 'accList,
    type : 'SObject',
    value : cmp.get('v.accountList')
flow.startFlow('Create_Account', inputVariables);

Note: In list we have more than 20 records.

Write a Reply or Comment

Your email address will not be published.