Getting Started with Salesforce Flow – Part 68 (Configure a Record Link Dynamically in Flow)

Getting Started with Salesforce Flow – Part 68 (Configure a Record Link Dynamically in Flow)

Last Updated on October 25, 2021 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:

  1. Define Flow properties for the Screen Flow:
    1. Add a screen to capture the user’s input:
      1. Add a Name component to capture the user’s input for First and Last Name.
      2. Add a Text component to capture the user’s input for the Company. 
    2. Add a Create Records element to create a new Lead. 
    3. Add a screen to display a confirmation message.
      1. Add a Display Text component to show a confirmation message with clickable URL. 
  2. Add Flow to the Lightning home page

Step 1: Salesforce Flow – Define Flow Properties   

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the New Flow.
  4. Select the Screen Flow option and click on Next and configure the flow as follows: 
    1. How do you want to start building: Freeform
  5. It will open the flow designer for you.

Step 1.1: Salesforce Flow – Add a Screen Element  

  1. Under Toolbox, select Elements. Drag and drop Screen onto the canvas. 
  2. Input the following information:
    1. Enter Label the API Name will auto-populate.
  3. Click Done

Step 1.1.1: Salesforce Flow – Add a Name Component to Capture the User’s Input for First and Last Name

  1. Under Input section on the Screen Element, drag and drop the Name component onto the screen. 
  2. Input the following information:
    1. Enter a name in the API Name field; the Label will auto-populate.
  3. Click Done.

Step 1.1.2: Salesforce Flow – Add a Text Component to Capture the User’s Input for the Company

  1. Under Input section on Screen Element, drag and drop the Text component onto the screen. 
  2. Input the following information:
    1. Enter a name in the Label field; the API Name will auto-populate.
    2. Select Require checkbox.
  3. 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. 

  1. Under Toolbox, select Elements. Then, drag and drop Create Records onto the canvas. 
  2. Input the following information:
    1. Enter Label the API Name will auto-populate.
    2. How Many Records to Create: One
    3. How to Set the Record Fields: Use separate resources, and literal values
    4. Object: Lead
    5. Set Field Values for the Lead 
      1. Row 1:
        1. Field: FirstName
        2. Value: {!Name.firstName}
      2. Add Field
      3. Row 2
        1. Field: LastName
        2. Value: {!Name.lastName}
      4. Add Field
      5. Row 3
        1. Field: Company
        2. Value: {!Company}
  3. Click Done.

Step 1.3: Salesforce Flow – Add a Screen to Display a Confirmation Message 

  1. Under Toolbox, select Elements. Then, drag and drop Screen onto the canvas. 
  2. Input the following information:
    1. Enter Label the API Name will auto-populate.
  3. Click Done

Step 1.3.1: Salesforce Flow – Add a Display Text Component to Show a Confirmation Message with Clickable URL

  1. Under Input section on Screen Element, drag and drop the Display Text component onto the screen. 
  2. Input the following information:
    1. Enter a name in the API Name field.
    2. Type your message in the text box.
    3. Now we are going to create a clickable URL. For this, select click here (1) texts and click on the link icon(2).
    4. It will open a pop-up for you. Now type the message (3) as shown in the following screenshot.
    5. You might be wondering 🤔  –  what is {!createLead}? Well, {!createLead} variable is auto created by Flow to hold the newly created Lead Id.
  3. At the end, your conformation screen will look like the following screenshot
  4. 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: 

  1. Click Save.
  2. Enter Flow Label the API Name will auto-populate.
  3. Click Show Advanced.
  4. Type: Screen Flow
  5. API Version for Running the Flow: 52
  6. Interview Label: Create Dynamic Record Link {!$Flow.CurrentDateTime}
  7. 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.

  1. Click Setup.
  2. In the Quick Find box, type Lightning App Builder.
  3. Select Lightning App Builder then click on the Edit next to the Home page.
  4. From the Lightning Components pane on the left, drag the Flow component onto the Lightning page canvas.
  5. Input the following information:
    1. Select Flow Create Dynamic Record Link
    2. Layout: One Column
  6. 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
Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.