How to Create a Record Link in Flow

How To Create a Record Link in Flow

Flow is the number one automation tool of Salesforce. There are endless things that you can perform using Salesforce Flow. In many cases, you might need to create a link to a record in flow. For instance, if it is a screen flow, you can display a link to the record. So that the users can navigate to the record by clicking the link. Another great use case is sending an email that contains a link to a record.

There are a few ways to create a record link in Salesforce Flow. The goal is to build a link in this format:

As you can see, the first part will always be the same. You just have to put the record’s id to the right side.

Since the left side of the link will be different in every environment (sandbox and production), it shouldn’t be hardcoded. The important part is to make the link dynamic. So that after deploying the flow between environments, you won’t need to edit the flow and fix the link. Therefore, it is not recommended to put a hardcoded link. So, how can you create a dynamic link?

Create a Link Using a Custom Label

The first option to create a link is using a custom label.

1- Create a custom label in setup and put your Salesforce environment’s url as the value.

Create custom label to store the environment's url

2- You can create a formula resource or a text template in order to create the record link. Use the Label global variable in order to bring the custom label that you created in the previous step. Then put a “/” and the record’s id to the right side of the custom label.

Formula for record link
Text template for record link

After creating a resource for the record link, select the text that you want to display as hyperlink. Then, click on the link icon and use the resource that you created.

Make text clickable

This option can be considered as half dynamic, because the first part of the url is still hardcoded in the custom label. When you deploy the custom label to another environment, don’t forget to replace the value. Since it is coming from a custom label, you don’t need to modify the flow. Once you change the value in the custom label, it will be reflected in your flows.

Display record links in screen flow

Create a Link Using API Global Variable

The second option is using the Api global variable. This global variable stores the Enterprise Server URL and Partner Server URL values.

Api global variables

There are many options for Enterprise Server URL and Partner Server URL in this global variable. However, as you can see from the screenshot below, they all start with the url of the environment. Therefore, you can use any of them in this use case.

Api global variable values

1- Create a formula resource and add one of those global variables. Since you need the environment’s url, you have to use some functions to remove the unnecessary part.

Using Api global variable in a formula

2- After creating the formula, select the text that you want to display as a hyperlink. Then, click on the link icon and use the resource that you created.

Api global variable to display record link

This option is completely dynamic and it is the recommended solution. Once you deploy the flow to another environment, you don’t need to change anything.


Here is a simple flow that creates an account record. After creating the account, the Id of the new account record is stored in the variable called {!Create_Account}. Then the flow displays a link for the new record, which lets the user navigate to the new record.

Flow to create account

Here is the formula for the record link formula:

LEFT({!$Api.Partner_Server_URL_550}, FIND( ‘/services’, {!$Api.Partner_Server_URL_550})) & {!Create_Account}

After creating the record, it displays a hyperlink for the new account record.

Display new account's link.


    • Hi,
      $Api global variable stores the API URLs.
      For example, $Api.Enterprise_Server_URL_140 is the merge field value for version 14.0 of the Enterprise WSDL SOAP endpoint.
      In this use case, we just need the URL (we can remove the part after .com). So using a formula, we just remove the part after .com and then we add the record Id. So it becomes the correct link for that record.

  1. Hi Yumi — This is super helpful. Quick question: On the dynamic formula you provided at the end of the article, did you mean to write {!Create_Account} in reference to the record ID or should it be {!recordId} as previously written further above?

  2. How to send Fault Message from salesforce Flow to Email Template, as there is no $Flow.FaultMessage merge field available in email template?

    • I can think of 2 possible solutions:
      1- Create a text template in flow and use the Send Email core action to send the email, not an email alert.
      2- Save the value of the fault message to a custom field and use it in an email template/email alert.

  3. This is great! One question I have is how did you embed your RecordLink_Formula into the “Click Here” text. In my use case I want to embed the record link into the standard field for record name.

  4. Thanks, Yumi. Great article.

    When I copied across your formula the ‘ marks around /services came through as a different character, so I initially had a syntax error. Easy to fix for anyone else who may have the same problem.

    • Hi,
      Data table can display formula fields with hyperlink. So, once I did a workaround. I updated a field on the record (from the same flow) and then displayed a formula field (that displays a link), which uses the value that I populated.

  5. Hello Yumi
    I need one help I want to. Open some screen flow or screen with some value after click link and after save or see screen return.same flow window

    Can we open other screen window or screen flow same predefined value
    It’s lite urgent

    • Flows have URLs too, so it is possible to display the URL of the screen flow that you want to open. But in your use case, you might want to use a subflow instead.

  6. Hi, thank you for this article; thought I would need a solution for a hyperlink in text template NOT IN A SCREEN ELEMENT (everywhere on the internet I found only the solution of a hyperlink in a screen element); I need it for a record-trigger flow and unfortunatelly in a text area is Click here
    or Click here to open the record.
    I would need to be displayed the ‘Click here’ hyperlink without the URL or the usual HTML tags in a text template.
    Thank you; I would heartfully appreciate any help!

    • Hi, you can do the same logic to create a text template with “Click Here”.
      Create a formula resource for the record URL and then use it in your text template.
      This is a great use case of including a “Click Here” in email bodies.

Leave a Reply

Your email address will not be published.