How to Launch Screen Flow in Modal from List View

How to Launch Screen Flow in Modal from List View

There are several ways to launch Screen Flows in Salesforce, and using an Action button on a record is one of the most common. This method opens the flow in a modal window, creating a seamless user experience. However, if you want to launch Screen Flow in a modal from list view, Action buttons aren’t supported. While you can use a custom URL button to open the flow from a list view, it will open in a new tab instead of a modal. Although Salesforce doesn’t offer a standard way to launch Screen Flow in modal from list view, there’s a simple workaround that makes it possible.

In this simple workaround, we will use a similar approach to the one described in this post. However, instead of using a formula field, we will use a custom button that opens an action.

Steps to Launch Screen Flow in Modal from List View

Let’s say you already have a Screen Flow that creates multiple Task records, and now you want to launch it directly from the Task list view. Here’s how you can set it up to open the flow from the list view.

1- Create an Action on your object (Task). Set the action type to Flow, then select the Screen Flow you want to launch.

Action to Launch Flow

This action will open the flow in a modal. However, as mentioned earlier, you can’t add it directly to the list view.

2- Create a URL button on the same object (Task). This button won’t launch the flow directly. Instead, it will open the Action you created in the previous step. Be sure to set the Display Type to List Button.

As you may know, actions automatically pass the record ID to Screen Flows, even if the Flow doesn’t have an input variable named recordId.

Since there’s no specific record ID to pass from the list view, you’ll still need to follow the same logic and include a valid ID value. Here’s the URL format you should use for your button.

/lightning/action/quick/Task.New_Task_Flow?context=RECORD_DETAIL&recordId={!CASESAFEID("00T000000000000")}&backgroundContext=%2Flightning%2Fo%2FTask%2Fhome

You’ll need to replace the bold parts of the URL with your own values. Let’s break down what each part means.

  • Task.New_Task_Flow: This part represents the object and the action the URL is launching. In this example, the object is Task, and the action name is New_Task_Flow.
  • 00T: As mentioned earlier, you need to pass a valid record ID, but it doesn’t have to be a real one. You can use the object’s key prefix followed by 12 zeros. Since the flow expects an 18-character ID, we use the CASESAFEID function. Just replace the key prefix (00T for Task) with the prefix of your object.
  • backgroundContext: This parameter controls the background of the modal. Since the flow is launched from the list view, it’s best to keep the list view visible in the background. To do that, replace "Task" with your object's API name so the pinned list view stays in place.

For example, if you want to apply this logic to the Account object and open an action called New_Account, here’s the URL you should use:

/lightning/action/quick/Account.New_Account?context=RECORD_DETAIL&recordId={!CASESAFEID("001000000000000")}&backgroundContext=%2Flightning%2Fo%2FAccount%2Fhome

Button to Launch Screen Flow in Modal from List View

3- Lastly, add the button to List View Button Layout.

Here is how it works.

Launch Screen Flow in Modal

Important Notes

This approach doesn’t allow you to select records from the list view and pass them to the flow. Read this post to learn how to pass multiple records to Flow.

Some objects don’t support using "home" as the background context. In those cases, you can try the following alternatives:

  • Using the object key prefix to set the background as the object’s home page:
    backgroundContext=%2Flightning%2Fo%2F001
    This will set the Account home page as the background (where 001 is the key prefix of the Account object).
  • Using a specific list view as the background context:
    backgroundContext=%2Flightning%2Fo%2FTask%2Flist?filterName=Recent
    This will set the Recently Viewed list view of the Task object as the background.

    backgroundContext=%2Flightning%2Fo%2FTask%2Flist?filterName=OpenTasks
    This will set the "OpenTasks" list view of the Task object as the background.

34 Comments

    • Yes, it should work, but this specific URL/formula opens the list view in the background. If you want to use it from related list, you may need to change the backgroundContext.

      • It doesn't work for me. This is my URL:
        /lightning/action/quick/Request__c.CreateAdminRequest?context=RECORD_DETAIL&recordId={!CASESAFEID("a0B000000000000")}&backgroundContext=%2Flightning%2Fo%2Fa0B%2Fa0B

          • This still doesn't work. Removed the extra %2Fa0B at the end. The flow never starts. The Spinner spins indefinitely.

            /lightning/action/quick/Request__c.CreateAdminRequest?context=RECORD_DETAIL&recordId={!CASESAFEID("a0B000000000000")}&backgroundContext=%2Flightning%2Fo%2Fa0B

          • Is there a chance to make this dynamic {!CASESAFEID("a0B000000000000")}
            As it is a custom object record and it differs from org to org

    • To launch it as a related list button (ie. override the "New" button on a related list) here is what you need to to:
      1. create an action on the parent level that launches a screen flow.
      2. create a list button on the child level using the following URL. Replace the following parameters:

      -PARENT_OBJECT_API_NAME
      -API_NAME_OF_ACTION

      /lightning/action/quick/PARENT_OBJECT_API_NAME.API_NAME_OF_ACTION?objectApiName&context=RECORD_DETAIL&recordId={!CASESAFEID(PARENT_OBJECT_API_NAME.Id)}&backgroundContext=%2Flightning%2Fr%2FPARENT_OBJECT_API_NAME%2F{!CASESAFEID(PARENT_OBJECT_API_NAME.Id)}%2Fview

  1. Great post thanks! I was looking for something like this for several months now as I did something quite similar but without the 12 zeros workaround so back then I shamefully hardcoded an existing account id the button url... I tried your solution with the CASESAFEID but it's not working: the modal appears with a spinner and the frist screen of my screen flow never appears (the spinner spins indifinetly). Any ideas as to what I am doing wrong?

    • Hi Baptiste,
      Can you please send me the URL? Did you put your object's key prefix followed by 12 zeros?

      • Got the same issue as @Baptiste, this is my URL:
        /lightning/action/quick/WorkOrder.Create_Work_Order_Flow?context=RECORD_DETAIL&recordId={!CASESAFEID("0WO000000000000")}&backgroundContext=%2Flightning%2Fo%2FWorkOrder%2Fhome

          • Work perfect now, thanks a bunch Yumi!
            Any reason why initial url did not work?
            Aiming to apply this on several orgs, so a bit of context would help.
            Thanks!

    • Hi Cem,
      Unfortunately, this approach doesn’t allow you to select records from the list view and pass them to the flow.

  2. I followed the instructions, but although the flow pops up as a modal, it ends and disappears immediately after.
    here is the url I use
    /lightning/action/quick/Account.List_View_Action?context=RECORD_DETAIL&recordId={!CASESAFEID("001000000000000")}&backgroundContext=%2Flightning%2Fo%2FAccount%2Fhome

    screen flow has one screen with a display element inside

    • Can you set the backgroundContext like this?
      &backgroundContext=%2Flightning%2Fo%2F001

      001 is the key prefix for the Account object.

  3. I am having the same issue as Eyal. The flow pops up as a modal for a split second and then disappears. I'm using a custom object, Shipment__c, and the prefix is a1X. Here is the URL I used:

    /lightning/action/quick/Shipment__c.Query_Shipments?context=RECORD_DETAIL&recordId={!CASESAFEID("a1X000000000000")}&backgroundContext=%2Flightning%2Fo%2FShipment__c%2Fhome

        • Hi Bao Do,
          Many thanks for your contribution. I was facing the same issue, but replacing the "Home" with the prefix solved it for me as well.
          However, there is a new issue:
          The screen flow opens nicely but I could see the background becomes blank. This means that once the flow finishes or the user closes the screen flow, a blank screen is shown instead of the initial List view. Any ideas? My formula is as follows:

          /lightning/action/quick/Opportunity.New_Deal_ACTION?context=RECORD_DETAIL&recordId={!CASESAFEID("006000000000000")}&backgroundContext=%2Flightning%2Fo%2F006%2F006

  4. OMG! OMFG! I usually never post on this sites about work and development stuff, but MAN you saved me! This was so smart! Since Copilot proposed this approach it sounded like a good idea but after some research, I found your article and seeing it actually work on my sandbox was like MAGIC! Like the first time you see your gifts beneath the Christmas tree! Client is going to be so happy. THANKS A LOT! 🙂

  5. hi, i just implemented this but the pop up keeps showing the loading screen, how can i solve this? URL used :/lightning/action/quick/Account.List_View_Action?context=RECORD_DETAIL&recordId={!CASESAFEID("001000000000000")}&backgroundContext=%2Flightning%2Fo%2F001

    • Hi Kelvin,
      I tried this URL and it worked for me:
      /lightning/action/quick/Account.List_View_Action?context=RECORD_DETAIL&recordId={!CASESAFEID("001000000000000")}&backgroundContext=%2Flightning%2Fo%2F001

      You have an action called List_View_Action on Account, right?

      Can you check if you have a variable called recordId? You don't need it, but maybe it is trying to pass the value to that variable but the data type doesn't match.

  6. Hi Yumi, Great WA!
    Is there any way not to hardcode the Prefix in the action formula?
    I considered using CMDT for that, but it isn't available as part of the formula builder of the List button.

    • Hi Avi, I couldn't find a way not to hardcode it. But you are hardcoding the fake record Id anyways, right?

      • The problem is not the hardcoding of the fake ID,
        My problem is that since the action is on a custom object,
        The prefix is different in each environment.
        Especially at the development phase (never work directly on Prod :-))

  7. Hello, I tried this right now, but it shows only the spinner, I change the recordId to an existing one and it works /lightning/action/quick/Product2.NewBuildingBlock?recordId={!CASESAFEID("01tMB000009TAVHYA4")}&backgroundContext=%2Flightning%2Fo%2F01T . So I cannot use a non existing Id. Any ideas?

1 Trackback / Pingback

  1. Launch Screen Flow in Modal for a Record in a Related List - Salesforce Time

Leave a Reply

Your email address will not be published.


*