I would like an image to show based on the "Rating" field picklist value. I keep getting syntax errors. Here's what I have.

IMAGE( IF(ISPICKVAL(Rating, "Cold"),"/servlet/servlet.FileDownload?file=015J0000000Wb4Q", IF(ISPICKVAL(Rating, "Warm"), "/servlet/servlet.FileDownload?file=015J0000000Wb4d", IF(ISPICKVAL(Rating, "Hot"), "/servlet/servlet.FileDownload?file=015J0000000Wb4b"), ) ) )

3 Answers 3


A simpler way to write this would be to use the CASE function vs. the IF statements, so something like this:

    "Warm", "/servlet/servlet.FileDownload?file=015J0000000Wb4d", 
    "Hot", "/servlet/servlet.FileDownload?file=015J0000000Wb4b",

Similar to the example below from the help docs here.

CASE( Priority, 
"Low", "/img/samples/flag_green.gif",
"Medium", "/img/samples/flag_yellow.gif",
"High", "/img/samples/flag_red.gif", 
"Priority Flag")

You left off the final ELSE argument on the third IF() function - I reworked the formula to be easier to read, assuming the "Cold" is the default image:

IF(ISPICKVAL(Rating, "Hot"), IMAGE("/servlet/servlet.FileDownload?file=015J0000000Wb4b"), 
  IF (ISPICKVAL(Rating, "Warm", IMAGE("/servlet/servlet.FileDownload?file=015J0000000Wb4d"), 
    IF (ISPICKVAL(Rating, "Cold", IMAGE("/servlet/servlet.FileDownload?file=015J0000000Wb4Q"), 

Here is the Example which i have used related for "TrafficSignals".Traffic signal is a picklist field with Red,yellow and Green.

IF :IF(logical_test, value_if_true, value_if_false)

Image :IMAGE(image_url, alternate_text [, height, width])

IF( ISPICKVAL(TrafficSignals__c, "Red"), 
    IMAGE("/img/samples/light_red.gif", "red",32,32), 
IF( ISPICKVAL(TrafficSignals__c, "Yellow"),
    IMAGE("/img/samples/light_yellow.gif", "yellow",32,32),
    IMAGE("/img/samples/light_green.gif", "green",32,32) 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.