Newer Version Available

This content describes an older version of this product. View Latest

Sample Contact Management Formulas

Available in: All Editions

For details about using the functions included in these samples, see Formula Operators and Functions Overview.

Contact's Account Discount Percent

This percent formula displays the account's Discount Percent field on the contacts page.

1Account.Discount_Percent__c

Contact's Account Name

This formula displays the standard Account Name field on the contacts page.

1Account.Name

Contact's Account Phone

This formula displays the standard Account Phone field on the contacts page.

1Account.Phone

Contact's Account Rating

Use this formula to display the Account Rating field on the contacts page.

1CASE(Account.Rating, "Hot", "Hot", "Warm", "Warm", "Cold", "Cold", "Not Rated")

Contact's Account Website

This formula displays the standard Account Website field on the contacts page.

1Account.Website
If the account website URL is long, use the HYPERLINK function to display a label such as “Click Here” instead of the URL. For example:
1IF(Account.Website="", "",
2	IF(
3		OR(LEFT(Account.Website, 7) = "http://",LEFT(Account.Website, 8) = "https://"), 
4		HYPERLINK( Account.Website , "Click Here" ), 
5		HYPERLINK( "http://" & Account.Website , "Click Here" )
6	)
7)

This formula also adds the necessary "http://" or "https://" before a URL if neither were included in the URL field.

Contact's LinkedIn™ Profile

You can configure a link that appears on your contacts' profile page that sends you to their LinkedIn profile. To do so:
  1. From Setup, click Customize | Contacts | Buttons, Links and Actions.
  2. Click New Button or Link.
  3. Enter a Label for this link, like LinkedInLink.
  4. Enter this formula in the content box:
    1http://www.linkedin.com/search/fpsearch?type=people&keywords
    2={!Contact.FirstName}+{!Contact.LastName}
  5. Click Save.
Remember to add this link to the Contact page layout in order for it to show up.

Contact Identification Numbering

This formula displays the first five characters ofta name and the last four characters of a social security number separated by a dash. Note that this example uses a text custom field called SSN.

1TRIM(LEFT(LastName, 5)) &
2                    "-" & TRIM(RIGHT(SSN__c, 4))

Contact Preferred Phone

This formula displays the contact’s preferred contact method in a contact related list—work phone, home phone, or mobile phone—based on a selected option in a Preferred Phone custom picklist.

1CASE(Preferred_Phone__c, 
2"Work", "w. " & Phone, 
3"Home", "h. " & HomePhone, 
4"Mobile", "m. " & MobilePhone, 
5"No Preferred Phone")

Contact Priority

This formula assesses the importance of a contact based on the account rating and the contact's title. If the account rating is Hot or the title starts with Executive, then the priority is high (P1). If the account rating is Warm or the title starts with VP then the priority is medium (P2), and if the account rating is Cold then the priority is low (P3).

1IF(OR(ISPICKVAL(Account.Rating, "Hot"), CONTAINS(Title, "Executive")), "P1", 
2
3IF(OR(ISPICKVAL(Account.Rating, "Warm"), CONTAINS(Title, "VP")), "P2", 
4
5IF(ISPICKVAL(Account.Rating, "Cold"), "P3", 
6
7"P3")
8)
9)

Contact Yahoo! ID

This formula displays a clickable Yahoo! Messenger icon indicating if the person is logged on to the service. Users can click the icon to launch a Yahoo! Messenger conversation with the person. This example uses a custom text field called Yahoo Name on contacts where you can store the contact's Yahoo! Messenger ID.

1HYPERLINK("ymsgr:sendIM?" & Yahoo_Name__c,
2                    IMAGE("http://opi.yahoo.com/online?u=" & Yahoo_Name__c &
3                    "&m;=g&t;=0", "Yahoo"))

Dynamic Address Formatting

This formula field displays a formatted mailing address for a contact in standard format, including spaces and line breaks where appropriate depending on the country.

1CASE(ShippingCountry, 
2"USA", 
3  ShippingStreet & BR() &
4  ShippingCity & ", 
5  " & ShippingState & " " & 
6  ShippingPostalCode & BR() 
7  & ShippingCountry, 
8"France", 
9  ShippingStreet & BR() & 
10  ShippingPostalCode & " " & 
11  ShippingCity & BR() & 
12  ShippingCountry, "etc")

Telephone Country Code

This formula determines the telephone country code of a contact based on the Mailing Country of the mailing address.

1CASE(MailingCountry, 
2"USA", "1", 
3"Canada", "1", 
4"France", "33", 
5"UK", "44", 
6"Australia", "61", 
7"Japan", "81", 
8"?")

Unformatted Phone Number

This formula removes the parentheses and dash characters from North American phone numbers. This is necessary for some auto-dialer software.

1IF(Country_Code__c = "1", MID( Phone ,2, 3) & MID(Phone,7,3) & MID(Phone,11,4), Phone)