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?

Leave a Reply

Your email address will not be published.