Tips for Using Hyperlinks in Formulas
Get tips on using formula fields that contain a HYPERLINK function.
Learn how to control link target behavior and predict how relative and external links open.
Plus, find guidance on supported URL protocols in Lightning Experience.
Required Editions
| Available in: both Salesforce Classic and Lightning Experience |
| Available in: All Editions |
To create clickable links in Formula fields, use the HYPERLINK function or a valid URL. If you
have formula custom fields that contain a HYPERLINK function, the server generates an HTML anchor for
the link. For example, this function: HYPERLINK("/apex/VF_TEST", "VFLINK",'_self') generates this
HTML output: <a href="/apex/VF_TEST"
target="_self">VFLINK</a>. If the HYPERLINK function doesn't contain a
target attribute, it defaults to a value of target="_blank" in the generated HTML. A value of "_blank" opens the link in a new window
or browser tab, outside of Lightning Experience or the Lightning
Console.
- The
HYPERLINKfunction doesn’t support thebiztelprotocol on record home pages for custom objects in Lightning Experience. - The HYPERLINK function only supports specific URL protocols in Lightning Experience.
If the formula uses an unsupported protocol, the URL is removed and the anchor tag is
rendered without a valid href.
Supported protocols include:
ftp,ftps,http,https,mailto,tel,callto,cid,xmpp,ciscotel, andnavision. For details, see theFormatted Rich Text.
The Lightning Experience Honors Target Values for Hyperlinks in Formula
Fields critical update ensures that the target value for hyperlinks is honored, whether it's explicitly configured or
set by default. If you have enabled the critical update, you can keep the target page within
Lightning navigation by adding a value of target="_self" to your formula field HYPERLINK functions. If you specify something other than target="_self", the link opens with standard browser
navigation outside of Lightning Experience.
If you haven’t enabled the critical update, relative links open in a new tab regardless of
the target value.
target value.| Link Type | Target | Expected Behavior | Example |
|---|---|---|---|
| Relative Visualforce page or image |
_self
|
The Visualforce page or image opens in Lightning Experience or Console inside the same browser tab. Whether the link opens in a new subtab or in the same workspace tab depends on the Console app’s navigation rules. By default, links from record detail pages open in a new subtab, and links from reports open in the same workspace tab. |
HYPERLINK("/apex/VFPAGE", "Visualforce Page",
"_self")
|
| Relative Visualforce page or image |
_blank
|
The Visualforce page or image opens outside of Lightning Experience or Console in a new browser tab. A critical update that is available in Winter ’19 and automatically enabled in Summer ’19 on May 17, 2019 controls this behavior. If you don’t enable the critical update, these links open inside Lightning Experience or Console in a new browser tab. |
HYPERLINK("/img/logo214", "Logo",
"_blank")
|
| External website |
_self
|
The website opens in a new browser tab. |
HYPERLINK("https://salesforce.com", "Salesforce",
"_self")
|
| External website |
_blank
|
The website opens in a new browser tab. |
HYPERLINK("https://salesforce.com", "Salesforce",
"_blank")
|
