Salesforce image formula fields display image icons to Salesforce users according to the field value/s a record has, instead of calculating a number, or outputting a string of text. Simply speaking, the formula statements will ask: “if this equals [some value], show [image A], if not, show [image B]”. This is a basic, two-line example, and you may already know that Salesforce formulas can be several lines long, to switch between different images in formula fields.
Image formulas in Salesforce are a great addition to your org to help users to digest information quickly on records or list views, and bring their attention to what’s important. Salesforce image fields can be tricky to apply on your first few attempts, which is why we’ve included Salesforce image formula examples to get you started.
How Do I Use a Graphics Pack in Salesforce?
Let’s begin by downloading the Salesforce Graphics Pack from the AppExchange. Thanks to our friends over at Salesforce Labs, we instantly have a whole host of icons to play around with.
Access your Salesforce image library by heading to the App Launcher (waffle icon), and searching “Lightning Graphics Pack”:
This launches an icon library with several tabs (‘Farm Fresh’, ‘Icon Shock’, ‘Tango Desktop Project’, etc. are icon developers. The icons are not categorized in any other way). Take a look around, there are hundreds to choose from!
How Do I Apply an Image Formula in Salesforce?
In this tutorial, we will add an “Account Health” formula field, based on the standard “Rating” picklist field.
What is a Formula in Salesforce? If you’re new to formulas check out this Trailhead module.
Step 1: Create a custom formula field
In Salesforce Setup, head to the Object Manager → Account → Fields & Relationships → ‘New’ (button).
- Choose the field type: Formula
- Field label: Account Health
- Formula Return Type: Text*
*note there is no option for ‘image’ return type, which often trips people up.
Step 2: Write the Salesforce image formula
Here’s the whole formula and what each part of the formula means:
CASE(Rating,
"Hot", IMAGE("/resource/1523798147000/GraphicsPackNew/silk/16/silk/medal_gold_1.png", "Hot"),
"Warm", IMAGE("/resource/1523798147000/GraphicsPackNew/silk/16/silk/medal_silver_1.png", "Warm"),
IMAGE("/resource/1523798147000/GraphicsPackNew/silk/16/silk/medal_bronze_1.png", "Cold"))
- CASE: a Salesforce formula function where you have multiple statements relating to picklist field values. In this example, the formula is asking “if the rating is “Hot” then show [image A], if the rating is “Warm” then show [image B], if the rating is “Cold” then show [image C]”.
- IMAGE: indicates you are about to reference an image file.
- “/resource/… : the image URL. Clicking on an icon in the Graphics Pack will open the file in a new tab. That tab contains the URL, eg. [your domain]/resource/1630492553000/GraphicsPackNew/fatcow/farmfresh/16/film.png
- “Hot”: you see the picklist value repeated after the image URL – that’s known as the Alt text. That will appear to the user in case the image doesn’t load properly, so is a good fallback option.

Before you write your formula, pick out the graphics you want to use, and list out the image file URLs and picklist values. Copying and pasting from your notes will make building the formula in the formula editor clearer.
Click “Check Syntax”, which will check your formula is written correctly and references fields that exist.
Step 3: Test the logic
Test all scenarios by selecting each picklist value at a time, clicking save, and checking the icon you expect appears on the record.
Note: the icon won’t change until you save the record.
Step 4: Add the icons where users need it
Add the image formula field to:
- Record pages
- The highlights bar on record pages
- List views

Salesforce Image Formula Examples
Account Health Rating
The example in the tutorial was based on the standard “Rating” field, however, your organization may have another definition of what a ‘healthy’ account looks like. Could it be the last activity date? If they are approaching the end of a contract, and there’s no renewal opportunity being worked on?
Case Status Image
Quickly show which Cases need attention with a simple image field based on Case “Status”:

CASE(Status, "New", IMAGE("/resource/1523798147000/GraphicsPackNew/silk/16/silk/star.png", "New"),
"Working",IMAGE("/resource/1523798147000/GraphicsPackNew/silk/16/silk/comments.png", "Working"),
"Escalated",IMAGE("/resource/1523798147000/GraphicsPackNew/silk/16/silk/flag_red.png", "Escalated"),
IMAGE("/resource/1523798147000/GraphicsPackNew/silk/16/silk/heart.png", "Closed"))
Lead Score
If your users have a high volume of leads to work through, help them prioritize who’s worth talking to by highlighting sales-ready prospects, leads from target accounts, or that fit your ideal customer profile.

The most simple version is to base the formula on the standard “rating” field.
If you use a marketing automation platform, it almost certainly has lead scoring functionality (usually a number) that can be synced across to Salesforce. This tutorial shows you how to create a Salesforce star rating formula fields for Pardot Prospect score:
Mailability Flags
Another of my favorites to add to Salesforce orgs is flags to make communication preferences highly visible. Not only does this stop users contacting people who have opted out, it also helps sales and marketing teams work together (this is because marketing emails are treated differently to one-to-one contact).
Display a coloured flag on the Lead or Contact record in Salesforce according to the channels you want to cover (email, phone SMS):
In this example, the colour flags apply as follows:
- Green = If not opted out of any
- Orange = IF Opted out of Email OR Phone OR SMS
- Red = If not opted out of all (Email AND Phone AND SMS)
IF
(HasOptedOutOfEmail = TRUE && DoNotCall = TRUE && SMS_Opt_Out__c = TRUE,
IMAGE("/img/samples/flag_red.gif", "Red Flag"),
IF
(HasOptedOutOfEmail = TRUE || DoNotCall = TRUE || SMS_Opt_Out__c = TRUE,
IMAGE("/img/samples/flag_yellow.gif","Yellow Flag"),
IMAGE("/img/samples/flag_green.gif","Green Flag")))
Read this tutorial for more examples: Create Mailability Flags in Salesforce for Highly Visible Communication Preferences
Final Thought
Now that you’ve seen the power of image formulas, ask yourself the question, “Where can my users benefit the most from images?” You don’t want to use images for the sake of it, but to help users get a glimpse of the status of their data.
Comments: