Skip to main content

Salesforce Lightning Flow Redirect

By April 1, 2020July 11th, 2020No 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

White Paper
June 14, 2022

How digital tools help educators identify and support at-risk students

This White Paper elaborates on how Salesforce CRM offers the optimum solution for your business, leverages its performance, and multiplies your revenues / increases your ROI. Investment in Salesforce CRM…
June 1, 2022

Best and Simple Practices to Implement Salesforce Marketing Cloud

Best and Simple Practices to Implement Salesforce Marketing Cloud Salesforce Marketing Cloud is a powerful tool from Salesforce that automates an organization’s marketing across email, social media, mobile apps, SMS,…
Salesforce classic to lightening migrationSalesforceUncategorized
May 12, 2022

Why Salesforce Classic to Lightning Migration is Critical for Businesses?

Why Salesforce Classic to Lightning Migration is Critical for Businesses? Salesforce Classic, the main interface for the Salesforce CRM platform, has long been replaced with newer and sleeker Salesforce Lightning,…