Launch flow modal from a related list
If you have experience with screen flows you might have thought that it would be useful to call a flow from a list buttons — used in list views or related lists — in a similar fashion when called from actions, i.e. the flow is rendered on a modal, instead of the full page mode.
Here’s how to achieve it:
Steps
- Create screen flow.
- Create action on object that you wish to run the screen flow against.
- Get action URL.
- Create list button on related object.
- Add list button to the related list.
1. Screen flow
Configuration of flow that you want to run on the modal.
2. Create action on object
that you wish to run the screen flow against, for example: if the screen flow is to be launched from an Account related list , then the action should be created against the Account.
3. Get action URL.
Add the action in the lightning page, once added the click on the button and copy the URL:
/lightning/action/quick/Account.Call_demo_flow?objectApiName&context=RECORD_DETAIL&recordId=5008d000003uMT3AAM&backgroundContext=%2Flightning%2Fr%2FAccount%2F5008d000003uMT3AAM%2Fview
The URL can be broken down into:
- Action Name: action/quick/Account.Call_demo_flow
- Action Parameters: objectApiName; context; recordId and backgroundContext
4. Create list button
on the related object in which you wish to add the list button.
Update the URL to have dynamic values:
/lightning/action/quick/Account.Call_demo_flow?objectApiName&context=RECORD_DETAIL&recordId={!CASESAFEID(Account.Id)}&backgroundContext=%2Flightning%2Fr%2FAccount%2F{!CASESAFEID(Account.Id)}%2Fview
! The action will only work with 18 length Ids, so the function CASESAFEID must be used.
5. Add list button
to the related list.
! Similar approach can be used to launch flows on modals from list views.