Adding A New Custom Button to Launch Flows

Updated 08/09/2022

So now we have built the flow we need to create a button and add it to the page layout to launch the flow. In lightning, there are options of including it on the lightning page so in this we will cover both methods. You can do this with any screen flow even though this is a direct follow-on from the account contacts.

Adding A Button

We are going to add this to the page first we need to go to the flow and click on view details and versions on the flow list view. Once you are on the flow details copy the URL as we will need this if we create a custom button.

Next, go to the Account Object in object manager and click Button, Links, and Actions. For this, we will use New Button or Link so click that button. Add the following as the below image. We will set it to Detail Page Button which will be available to add to buttons and lightning actions in page layouts.

In the long text part where we use the merge fields. Past in the URL link from the flow make sure to include the /flow/ at the end of URL make sure to include a “?” this is then followed by variables you want to pass in. So recordId is a variable you have put in and set it to pull through the Account.Id using the merge fields. You can do this through a New Action and select the flow; This will work in this instance because you are only passing one variable of recordId and it only takes one variable through actions. Click Save to save this.

Button Configuration screen for launching flow.

Adding To Page

To add to the page you will need to go to the page layout/layouts you want this on. For Classic, you will add it to the custom button section and in Lightning, you would put it in Salesforce Mobile and Lightning Experience section as below. Click save on the page layout and repeat for as many page layouts as you need.

Now you have finished this you will be able to go to an account page and click the button to trigger the screen flow. Run through a couple of tests making sure you are testing the new contact and updating contact features on some test demos. If this all goes well you are ready to release this. If something is not working you can revisit past steps to see what you may have missed.

Signing Off

So what we have now built is a screen flow system for adding and updating Contacts on accounts with partial matching for email addresses and phone numbers which you can launch from a button. Your next steps may be to include additional phone numbers or other fields like Position.

When you are comfortable with all this you may want to try a project built like this one on the flow-based record distribution system.

Published 23/08/2022
Category: Beginner Friendly, Tutorials

Other Posts