Use Images in Salesforce Formula Fields to Spice up Your Org

One of Salesforce’s most attractive features is the ability to customise anything and everything. Buying an off the shelf product but being able to completely tailor it to your unique business processes is one of the reasons Salesforce is No 1. A feature that has been around for quite some time, is the ability to add images to Salesforce formula fields. This essentially means instead of calculating a number, or outputting a string of text, the formula fields “result”, can be a series of images depending on the scenario. Our friends over at Salesforce Labs have given us some basic images for quite some time, however with the recent overhaul of the Graphics Pack on the AppExchange, we have a whole host of icons to play around with.

If you’ve ever seen an official Salesforce demo, you might notice that they put a huge amount of effort into using images and icons to show different states of records. The reason? It looks a lot more aesthetically pleasing and information can be digested quicker. Let’s look at a few examples where icons can be tremendously helpful in improving the usability and aesthetics of your Org.


1. Account Health Rating – Could be based on last activity date, or other metrics you hold in your Org.

2. Case Status Image – Simply based off of the Case Status to quickly show which cases need attention

3. Lead Score – Can be based on the rating field or a custom lead score field


Now that you’ve seen the power of images, let’s have a look at how to implement them. Before making changes to your Org, I would ask yourself the question, “Where can my users benefit the most from images?”. You don’t want to just start using images for the sake of it, but to help users get a glimpse of the status of their data.

1. Install the Graphics Pack – Using the following link, install the Graphics Pack from Salesforce Labs. This will give you access to pages and pages of icons.

2. Create a Formula Field – The next step is to create a formula field with the output type of Text

3. Prepare your output – Before creating your formula field, it’s a good idea to select the graphics you want to use and prepare the output that you will use. The images displayed are encased in the formula field function IMAGE. This is used in the following method… IMAGE(“Image URL”, “Alt text”). The Image URL is accessible once clicking on any image in the graphics pack, and you need to remember to grab everything after and including “/resource/….”. Alt text is simply a placeholder just in case the image can’t be displayed.

4. Create an IF or CASE Statement – The most common way to use image fields is using an IF or CASE statement. Reason being, you want your image to be dynamic based on data stored in the record. If we take a look at the Lead score examples from above, our case statement looks like this…

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”))

More Examples

Account Health Rating

CASE(Account_Health__c, “Good”, IMAGE(“/resource/1523798147000/GraphicsPackNew/tangodesktopproject/16/theme/dialog-error.png”, “Red”), 

“Ok”, IMAGE(“/resource/1523798147000/GraphicsPackNew/tangodesktopproject/16/theme/emblem-important.png”, “Orange”), 

IMAGE(“/resource/1523798147000/GraphicsPackNew/fatcow/farmfresh/16/tick.png”, “Green”))

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”))

Subscribe To The Monthly Newsletter

No Spam. No Rubbish. Just great content from the Salesforce Industry.

You have Successfully Subscribed!

3 thoughts on “Use Images in Salesforce Formula Fields to Spice up Your Org

  1. Nicolas COMMEAUX


    Thanks for these examples !

    Formulas are also a good way to display “Progress bars” thanks to 3 “One pixel images” and a simple formula :
    IF (Amount_Realized__c > Amount_Objective__c, IMAGE(‘/resource/green’, ‘Test’, 15, 100),
    IMAGE(‘/resource/blue’, ‘Test’, 15, Amount_Realized__c/Amount_Objective__c * 100) &
    IMAGE(‘/resource/grey’, ‘Test’, 15, (100 – Amount_Realized__c / Amount_Objective__c * 100 )))

  2. Hello,
    i’ve just test this package and your example are not working.
    to have image into your formula field you have to launch Document ID of your image and URL of your image

    for Example to have medal on your leads you have to create formula field like this:

    CASE( Rating ,
    “Hot”, IMAGE(“/servlet/servlet.FileDownload?file=0150Y000001kngV”,”Hot”,16,16),
    “Warm”, IMAGE(“/servlet/servlet.FileDownload?file=0150Y000001kngb”,”Warm”,16,16),
    “Cold”, IMAGE(“/servlet/servlet.FileDownload?file=0150Y000001kngP”,”Cold”,16,16),

Add Comment