Print this page

Create a custom field to automatically include hyphens

Knowledge Article Number 000212945
Description Business requirements may dictate that custom fields automatically include hyphens to separate text. We'll show you how to build the custom solution to fit  your specific business requirement.
Resolution

Hyphens are added in formulas by including them in between other statements with the concatenate function (&) and quotes ("") denoting text values.

Note: 

Spaces can be replaced with Hyphens in formulas, an example structure of this is & " " & or

 

An example structure of this is & "-" & 
 

Field/Function 
& "-" & 
Field/Function 
& "-" & 
Field/Function
 


Opportunity Name combines custom fields with hyphens

The below example formula combines the Account Name, the Opportunity Owners first and Last Name as well as the Closed Date.

 

Account.Name 
& "-" & 
Owner.FirstName 
& " " &  
Owner.LastName 
& "-" &  
TEXT(CloseDate)
 


Contact Identification Numbering

Displays the first 5 characters of the contact’s last name and the last 4 characters of the contact’s social security number separated by a dash. Note that this example uses a text custom field called SSN on contacts.

 

TRIM(
LEFT({!LastName}, 5)
)
& "-" &
TRIM(
RIGHT({!SSN__c}, 4)
)





promote demote