Multi-Select and Mass Update Records in Lightning List Views Using Flows, Visualforce and a List Button

You are currently viewing Multi-Select and Mass Update Records in Lightning List Views Using Flows, Visualforce and a List Button

After the Winter ’17 release, it is now possible to select records in Lightning List views when a List View button is placed on the List View Search layout of an Object. I saw this mentioned somewhere in the Winter ’17 release notes a while ago and had been itching to try it out using a Flow custom button placed on a List view in Lightning interface. I gave it a shot this morning and it worked just I had intended it to. This opens up a plethora of opportunities to create ‘mass/bulk actions’ which can work with selected or even all of the records in a List View.

Requirement: Wayne Enterprises wants its sales reps to have the ability to mass update owners across multiple Opportunities in a Lightning list view. The sales rep should be able to select records in the list view and specify the email of the new owner which would then mass update the records’ owner to be the new person.

Solution: We will be creating three components to design and implement our solution:

  • Flow: A screen flow that would accept user’s input (Email) and then update the selected records with the new owner
  • Visualforce Page: The flow would be embedded inside this Visualforce page and the page performs the primary job of passing over the selected records in the list view into a Flow SObject collection variable.
  • Custom List Button: This button will reference the Visualforce page and will be placed on the List view

So let’s get the ball rolling.

  1. Flow

    Within the Flow, our most important variable is the following which gets its values from the Visualforce page. This variable holds the record ID’s of all the selected records in the List View.

    varSelectedOpps variable


    ‘Update Owner’ Flow
  2. Visualforce Page

    The VF page holds our Flow and performs the vital task of passing the selected Record ID’s into the Flow collection variable: varSelectedOpps

    Visualforce Page
  3. Custom List Button

    And last but not the least, our final component that should be placed on the List View Search Layout of the object:

    ‘Update Owner’ List button


Let’s place our button on the List View and see the magic happen!

List View (Click on the image to get a larger view)

Once a sales rep clicks on the ‘Update Owner’ button, our flow launches:

User Input


Success message


And on the list view, see how the owner got updated across the selected records?

Yay! (Click on the image to get a larger view)


I can already think of a million ways to use this technique on list views and even related lists in Classic or Lightning. Happy Flow’ing!


This Post Has 9 Comments

  1. Eric Smith

    Any thoughts on how to apply and restrict this technique to a ‘filtered’ list? I’m thinking of use cases where you may want to perform an action on records that were selected from a list of records that would qualify for the action. For example, select only from a list of Closed Won Opportunities for a particular Account.

  2. Thyrn

    Thank you for describing this excellent solution that allows to mass update records using flow. Will it be possible for you to share the content of the flow in particular the implementation of the Loop and Record Update. I tried to implement the same solution for accounts and I encountered some problem when trying to loop through varSelectedAccounts collection that is a collection of SObject type Account. I am using the loop variable selectedAccount that is type Account. It looks like the loop doesn’t execute and there is not enough information in the logs to find out why.

    1. Thyrn

      I managed to solve this problem and I need to admit a very trivial mistake in my flow (not closing the for loop, I posted an idea to help to avoid this kind of mistakes: . Therefore my flow is working as expected. If I may suggest something I would recommend to replace Record Update from inside the loop and replace it with Fast Update outside the loop (that will update the collection of Accounts in one DML statement). This will reduce the number of executed SOQL and DML statements. For example for account mass update we could have:

      1. rakesh behera

        Hello Mike,
        Can you help me to get that flow created, how to pass that vf page to the flow?
        I need detail screen shot. And need to implement the same in my project.

        1. Thyrn

          Here is the Visualforce page that I used:

          Hope it helps.

      2. Ivan J

        Just wanted to add that this is a much more scalable solution – the original method as per the original post frequently breached our SOQL limits. Using Fast Update works like a dream.

  3. Michael

    I’m having an issue with my flow. I’m trying to update a picklist value on selected records from the list view. For the Record Update Element If I put a filter by the sObject variable ID it only updates one record. If I don’t use a filter it updates all records of the custom object.

    1. Michael

      Figured out my problem. The Loop was only iterating once since after the record update screen did not point back to the loop. As you can see from the picture above the arrow is only pointing in one direction.

  4. Scott Meridew

    Would love to see a flow solution more like the ‘change owner’ capability in classic … with a selection of “user”or “queue” and a lookup to find the user or queue to transfer ownership to …

Leave a Reply