2

I want to create a button on the related list which could open up a Screen flow as a modal.

enter image description here

2 Answers 2

2

Here's a simple solution without having to create a modal component or code anything.

Requirements:

  1. Make sure your screen flow has recordId as an input variable to capture the parent record Id.
  2. Create a new 'action' button on the parent object that contains the related list. Select your screen flow that contains the input variable 'recordId'.
  3. Place the button on the header of the page and click it. Then make sure to copy the URL (important).

Example URL I copied: /lightning/action/quick/Account.Call_Create_Opportunity_Flow?objectApiName&context=RECORD_DETAIL&recordId=001VC000006TriDYAS&backgroundContext=%2Flightning%2Fr%2FAccount%2F001VC000006TriDYAS%2Fview

In this case, I created the sample action button on the Account by: Object Manager --> Accounts --> new action button 'Call Create Opportunity Flow'.

Screenshot: The button successfully passes the Account recordId in the screen flow to create the child Opportunity.

From the URL you copied earlier, you'll notice a sequence within the parameters after the question mark '?'. If you adjust the values in bold to use the related list object, the model will render like a normal action button all while passing the recordId of the parent.

Here's the format you'll use to create a new custom button on your related child object. In this case, I created a custom button on the Opportunity since that is the child record I wish to create using the screen flow modal.

Replace the items in BOLD with your information:

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

It should look like this:

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

What you end up with is the same behavior as a standard action button. enter image description here

enter image description here

1

Unfortunately you can't do this directly.

However, you can create a component to house the flow and launch that component in a modal from the list view button. There's an example of this as an answer to this question:

https://developer.salesforce.com/forums/?id=9060G0000005Z2NQAU

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .