Loading
Important Advisory: iOS Update Impacting CG Mobile ApplicationRead More
Extend Salesforce with Clicks, Not Code
Tips for Working with Text in Formulas

Tips for Working with Text in Formulas

Get tips for working with text in formulas. Find guidance on using quotation marks to insert or concatenate text, escaping special characters with backslashes, and more.

Required Editions

Available in: both Salesforce Classic and Lightning Experience
Available in: All Editions
  • To insert text in your formula field, surround the text with quotation marks. For example, to display “CASE: 123,” use this formula "CASE: "& CaseNumber__c.
  • If a formula field is used in a Classic email template, surround empty spaces with quotation marks. Otherwise, use BR(). For example, use this formula for Classic email templates: TEXT( Amount ) &“ ”& TEXT( CloseDate ) &“ ”& TEXT( CreatedDate )
  • Use the backslash (\) character before a quote or backslash to insert it as a literal value in your output. For example, "Trouble\\Case \"Ticket\": " in your formula displays Trouble\Case "Ticket": on detail pages.
  • In Salesforce Classic, Knowledge articles show URLs from Formula (Text) fields as plain text. In Lightning Experience, Knowledge articles show such URLs as clickable links.
  • Before using the HYPERLINK function, consider the differences between hyperlinks and custom links.
    • Hyperlink formula fields are just like other custom fields that you can show in list views and reports.
    • Custom links appear on detail pages in a predefined section; hyperlink formula fields can appear on a detail page wherever you specify.
    • Using custom links, you can specify display properties such as window position and opening in a separate popup position. Hyperlink formula fields open in a new browser window by default or you can specify a different target window or frame.
    • Your formulas can reference custom links. Before deleting a custom link, make sure that it’s not referenced in a formula field.
    • Hyperlink formula fields that contain relative URLs to Salesforce pages, such as /rpt/reportwizard.jsp, can be added to list views, reports, and related lists. However, use a complete URL, including the server name and https://, in your hyperlink formula before adding it to a search layout.
 
Loading
Salesforce Help | Article