Last Updated on April 24, 2022 by Rakesh Gupta
Big Idea or Enduring Question:
How do you configure a record link dynamically in Flow?
Can I create a dynamic clickable link in Salesforce Flow that can be used with a Screen element – one of the most common questions that gets asked quite often! There are various ways to generate dynamic urls in Flow – you can either use the Hyperlink formula, a solution offered by Jennifer Lee or, maybe something else – it is up-to you.
I relentlessly ponder – is there a better, or another way, to do a particular thing? You should too! For, this is one of the best paths to creativity! And, we are all lucky – for, the beauty of the Salesforce platform is that a user can solve the same business requirement multiple ways with, or without, code.
In this article, I am going to share with you some tricks on how you can create a dynamic link for a record without creating any formula or extra resources.
Objectives:
This blog post will help us to understand the following:
- Dynamically create a record URL.
- Display a Confirmation message with a clickable link to the new record.
Business Use Case
Elise Shelley, a Lead App Developer at Universal Containers (UC), receives a requirement from his management. They want to develop an application that allows users to create a Lead record. At the end of the flow, they would like a confirmation screen that has a link to the newly created Lead record.
Automation Champion Approach (I-do):
There are a few possible solutions for the above business scenario but, I’ll use Screen Flow to solve the business requirement. The main reason for selecting Screen Flow is that we want to allow users to provide an input.
Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes going through the following Flow diagram and understand it.
Let’s begin building this automation process.
Guided Practice (We-do):
There are 2 steps to solve Elise’s business requirements using Screen Flow. We must:
- Define Flow properties for the Screen Flow:
- Add a screen to capture the user’s input:
- Add a Name component to capture the user’s input for First and Last Name.
- Add a Text component to capture the user’s input for the Company.
- Add a Create Records element to create a new Lead.
- Add a screen to display a confirmation message.
- Add a Display Text component to show a confirmation message with clickable URL.
- Add a screen to capture the user’s input:
- Add Flow to the Lightning home page
Step 1: Salesforce Flow – Define Flow Properties
- Click Setup.
- In the Quick Find box, type Flows.
- Select Flows then click on the New Flow.
- Select the Screen Flow option and click on Next and configure the flow as follows:
- How do you want to start building: Freeform
- It will open the flow designer for you.
Step 1.1: Salesforce Flow – Add a Screen Element
- Under Toolbox, select Elements. Drag and drop Screen onto the canvas.
- Input the following information:
- Enter Label the API Name will auto-populate.
- Click Done.
Step 1.1.1: Salesforce Flow – Add a Name Component to Capture the User’s Input for First and Last Name
- Under Input section on the Screen Element, drag and drop the Name component onto the screen.
- Input the following information:
- Enter a name in the API Name field; the Label will auto-populate.
- Click Done.
Step 1.1.2: Salesforce Flow – Add a Text Component to Capture the User’s Input for the Company
- Under the Input section on Screen Element, drag and drop the Text component onto the screen.
- Input the following information:
- Enter a name in the Label field; the API Name will auto-populate.
- Select Require checkbox.
- Click Done.
Step 1.2: Salesforce Flow – Add a Create Records Element to Create a New Lead Record
The next step is to create a Lead record. For this we will use the Create Records element.
- Under Toolbox, select Elements. Then, drag and drop Create Records onto the canvas.
- Input the following information:
- Enter Label the API Name will auto-populate.
- How Many Records to Create: One
- How to Set the Record Fields: Use separate resources, and literal values
- Object: Lead
- Set Field Values for the Lead
- Row 1:
- Field: FirstName
- Value: {!Name.firstName}
- Add Field
- Row 2
- Field: LastName
- Value: {!Name.lastName}
- Add Field
- Row 3
- Field: Company
- Value: {!Company}
- Row 1:
- Click Done.
Step 1.3: Salesforce Flow – Add a Screen to Display a Confirmation Message
- Under Toolbox, select Elements. Then, drag and drop Screen onto the canvas.
- Input the following information:
- Enter Label the API Name will auto-populate.
- Click Done.
Step 1.3.1: Salesforce Flow – Add a Display Text Component to Show a Confirmation Message with Clickable URL
- Under Input section on Screen Element, drag and drop the Display Text component onto the screen.
- Input the following information:
- Enter a name in the API Name field.
- Type your message in the text box.
- Now we are going to create a clickable URL. For this, select click here (1) texts and click on the link icon(2).
- It will open a pop-up for you. Now type the message (3) as shown in the following screenshot.
- You might be wondering 🤔 – what is {!createLead}? Well, {!createLead} variable is auto created by Flow to hold the newly created Lead Id.
- At the end, your conformation screen will look like the following screenshot
- Click Done.
Finally, as shown below, Elise’s Flow will look like the following screenshot (I turned on Auto-Layout) for this Flow:
Once everything looks good, take the steps below:
- Click Save.
- Enter Flow Label the API Name will auto-populate.
- Click Show Advanced.
- Type: Screen Flow
- API Version for Running the Flow: 52
- Interview Label: Create Dynamic Record Link {!$Flow.CurrentDateTime}
- Click Save.
Almost there! Once everything looks good, click the Activate button.
Step 4: Add Flow to the Lightning Home Page
The next step is to distribute the Flow to Lightning Experience or Salesforce App users by embedding it on a Lightning home page.
- Click Setup.
- In the Quick Find box, type Lightning App Builder.
- Select Lightning App Builder then click on the Edit next to the Home page.
- From the Lightning Components pane on the left, drag the Flow component onto the Lightning page canvas.
- Input the following information:
- Select Flow Create Dynamic Record Link
- Layout: One Column
- Once everything looks good, click the Save button.
Proof of Concept
From now onwards, whenever someone creates a Lead record using this Flow, the process will show the clickable URL at the end. Refer to the following video for demo:
Formative Assessment:
I want to hear from you!
What did you learn from this post? Was the post relevant? If you were to ponder different ways to configure a record link dynamically using a Flow, how would you modify the concepts taught in the post for your own business processes? Remember, relentlessly pondering different ways to do things is one of the best ways to learn how to configure creative solutions!
So, go ahead, take a plunge and then, make a post and tag me on Twitter @automationchamp using #AutomationChampionFlow.
Proofreader: - Munira Majmundar
Hi!
What if i need to use this funcionality for partner users?
´Cause the url to reach the record is different between internal and external users.
thanks!
Is there way that the new record opens in a console tab rather that opening a new browser tab?