Salesforce Lightning Flow Redirect

By April 1, 2020 July 11th, 2020 No Comments

Salesforce Lightning
Flow Redirect

Salesforce admins can customize the look and feel of their salesforce experience with flow builder. Here are guided steps to help build interactive custom components without any code

Redirect the flow to the Current Record.

Adding lighting component into Flow.

Adding Flow into Action Button and Home page.

To use all above-mentioned features we need a solid scenario. So I have created a sample flow which is useful for creating Quick contact from anywhere in the org, finally redirect to the actual contact.

Following 4 Screenshots will explain how to create a sample flow with the

Create a Screen Flow with Screen and Create Record Component.

Add Following Fields into the Screen Component

Lookup field (Account)

First Name

Last Name

Mobile Number

On the Create Record Component select values shown below.

Map the Account Values to Captured values from the flow.

How to Redirect from flow to currently created record.

There is no standard feature to redirect from flow to record page(created by this flow). So we have to write a simple Lighting Component(Aura). This is a very simple component specially no Apex coding required and no test classes at all. I have shared the code in below, Please copy and paste appropriate places. Get into the Developer console then
NEW→ Lightning Component

Choose any name and select all checkboxes as shown below as we are going to use this component in multiple places.

On NewFlow.cmp use the following code

On NewFlowController.js use the following code ({ init : function(component, event, helper) { var navEvt = $A.get(“e.force:navigateToSObject”); navEvt.setParams({ “recordId”: component.get(“v.recId”), });; } })

On use the following code

Save all files, Now the component is ready to use in our flow. Let’s get back to the flow which we have created earlier. Select a Screen flow to pull our Lighting Component(New Flow)

Search(Left Side) the NewFlow which will come under Custom, Pull the New Flow on the Screen.

Create a Text Variable and Place on Id of the record which we defined on

Open the Create Record Screen again

Scroll down up to the end,
Select Manually assign Variables(advanced)
Place the ID of the Record on the Store Contact ID in Variable.

Now the flow is ready to use as we expected. Now we can use this flow in multiple ways, I am going to show the following 2 ways.

Action Button

Lightning Pages(Home)

Go to Buttons, Links, and Action→ Create New Action

Select the Flow which we have created now(Quick Contact)

Pull the Action Button into the Page layout where you want to use.

Now the Flow is ready to use on the record page

Otherwise, we can add this flow into Home Page also
Go to the Home Page → Edit Page

Drag the Flow as shown direction in below and select the Quick Contact flow on the right side

Now the Flow is ready to use on the Lighting Page(Home Page)

Sample Contact Creation or Test our flow how it is working, the Flow will react the same way in any pages. Full fill the following fields

Once you submit the values the flow redirected to the newly created record.

Hope this will help you Trailblazers

Check out our other blogs

Learn more: Flow builder

Recent Posts

Top 10 highlights from salesforce winter 21Posts
September 4, 2020

Top 10 Highlights from Salesforce Winter’21 Release Notes

Salesforce Winter ’21 release is here, We have put together top 10 highlighted features for Admins and Developers with descriptions of enhancements and new features.
Top helpful youtube channelsPosts
July 17, 2020

Top Helpful Youtube Channels to get you started with Salesforce

Salesforce skills can help advance careers for beginners or for anyone who wants to get in the Salesforce ecosystem. Job seekers can find high-demand, high-paying and high-growth jobs
Salesforce Data Management & AnalyticsCase Study
July 8, 2020

A Leading Manufacturing Case Study

A Leading Manufacturing & Distribution Business - Case Study Download Document JTNDc2NyaXB0JTNFJTBBalF1ZXJ5JTI4JTIwZG9jdW1lbnQlMjAlMjkucmVhZHklMjhmdW5jdGlvbiUyOCUyNCUyOSUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyNCUyOCUyNy5ibG9nLXRpdGxlJTI3JTI5LnByZXBlbmRUbyUyOCUyNy5wb3N0LWNvbnQtbGVmdCUyNyUyOSUzQiUwQSUyMCUyMCUyMCUyMCUyNCUyOCUyMi5ib3R0b20tbWV0YSUyMiUyOS5hcHBlbmRUbyUyOCUyMi5wb3N0LWNvbnQtbGVmdCUyMiUyOSUzQiUwQSUyMCUyMCUyMCUyMCUyNCUyOCUyNy5mb290ZXItbXNnJTI3JTI5LnByZXBlbmRUbyUyOCUyNyUyM2Zvb3Rlci1vdXRlciUyNyUyOSUzQiUwQSU3RCUyOSUzQiUwQSUzQyUyRnNjcmlwdCUzRQ== (02) 40 584 100 JTNDc2NyaXB0JTNFJTBBalF1ZXJ5JTI4ZG9jdW1lbnQlMjkucmVhZHklMjhmdW5jdGlvbiUyOCUyOSU3QiUwQXZhciUyMGVsZW1Qb3MlMjAlM0QlMjAlMjhqUXVlcnklMjglMjIuZm9vdGVyLW1zZyUyMiUyOS5wb3NpdGlvbiUyO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