---
schema_version: "1"
id: 4b872f65b20f6908e1e59c22bbfbc26e3455223b2826b0f73cddd57d722ba564
title: Sample Contact Management Formulas
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/useful_advanced_formulas_contact_mgmt.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.useful_advanced_formulas_contact_mgmt.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: e44d2d3db573d22ae17586c178194d9e7913ee856765fdc3c6551a17f08676fd
description: Display account details on contact pages, create profile and website links, assign contact identifiers and priorities, and format addresses and phone numbers.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Sample Contact Management Formulas

Display account details on contact pages, create profile and website links, assign contact identifiers and priorities, and format addresses and phone numbers.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Essentials</strong>, <strong>Group</strong>, <strong>Professional</strong>, <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

For details about using the functions included in these samples, see [Formula Operators and Functions](https://help.salesforce.com/s/articleView?id=platform.customize_functions.htm&release=264.0.0&type=5 "Use these operators and functions when building formulas. All functions are available everywhere that you can include a formula, such as formula fields, validation rules, approval processes, and workflow rules, unless otherwise specified.").

## Contact's Account Discount Percent

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

```
Account.Discount_Percent__c
```

## Contact's Account Name

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

```
Account.Name
```

## Contact's Account Phone

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

```
Account.Phone
```

## Contact's Account Rating

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

```
CASE(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.

```
Account.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:

```
IF(Account.Website="", "",
	IF(
		OR(LEFT(Account.Website, 7) = "http://",LEFT(Account.Website, 8) = "https://"), 
		HYPERLINK( Account.Website , "Click Here" ), 
		HYPERLINK( "https://" & Account.Website , "Click Here" )
	)
)
```

This formula also adds the necessary "https://" before a URL if “http://” or “https://” wasn’t previously 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 the object management settings for contacts, go to 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:
    
    ```
    https://www.linkedin.com/search/fpsearch?type=people&keywords
    ={!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 of a name and the last four characters of a social security number separated by a dash. This example uses a text custom field called SSN.

```
TRIM(LEFT(LastName, 5)) &
                    "-" & 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.

`CASE(Preferred_Phone__c,  "Work", "w. " & Phone,  "Home", "h. " & HomePhone,  "Mobile", "m. " & MobilePhone,  "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).

```
IF(OR(ISPICKVAL(Account.Rating, "Hot"), CONTAINS(Title, "Executive")), "P1", 

IF(OR(ISPICKVAL(Account.Rating, "Warm"), CONTAINS(Title, "VP")), "P2", 

IF(ISPICKVAL(Account.Rating, "Cold"), "P3", 

"P3")
)
)
```

## 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.

```
HYPERLINK("ymsgr:sendIM?" & Yahoo_Name__c,
                    IMAGE("https://opi.yahoo.com/online?u=" & Yahoo_Name__c &
                    "&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.

```
CASE(ShippingCountry, 
"USA", 
  ShippingStreet & BR() &
  ShippingCity & ", 
  " & ShippingState & " " & 
  ShippingPostalCode & BR() 
  & ShippingCountry, 
"France", 
  ShippingStreet & BR() & 
  ShippingPostalCode & " " & 
  ShippingCity & BR() & 
  ShippingCountry, "etc")
```

## Phone Country Code

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

`CASE(MailingCountry,  "USA", "1",  "Canada", "1",  "France", "33",  "UK", "44",  "Australia", "61",  "Japan", "81",  "?")`

## Unformatted Phone Number

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

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