+ Start a Discussion
Manjunath SC 5Manjunath SC 5 

formula field to display images when the status of the picklist is changed

Hello all 

My requirement is that whenever i change the status in the picklict field different color should pop up,
In my requirement i have picklist field called flat status, in that there are 3 fields (Sold,available,Booked), whenever i click on Sold it should show as "red", when i click on Available it should show as "Green", when i click on booked it should show as "Yellow"

for this i have tried formula field and written a formula as
"Green", "/img/samples/light_green.gif",
"Yellow", "/img/samples/light_yellow.gif",
"Red", "/img/samples/light_red.gif", 
"status color")

The error shows as " Error: Field Flat_Status__c is a picklist field. Picklist fields are only supported in certain functions"

Is there any better way to achive this

Any Help or suggestion would be Highly appreciated
Hi Manjunath,
Hope this will help you.

Manjunath SC 5Manjunath SC 5

Thanks for the reply, but when i copy pasted their version of code, it showed a different error " Incorrect number of parameters for function 'IF()'. Expected 3, received 2"

any other suggestions:)
Raj VakatiRaj Vakati
where you are using the Flat_Status__cfield on the formula . is its complete formula ??
Manjunath SC 5Manjunath SC 5

This is my actual code

    IF(ISPICKVAL(Flat_Status__c, "Booked"), "sfc/p/7F000002d9r8/a/7F000000km5l/KigwemLKuavHWNM1soVWIAuHHZdjV_Scjvb4y8W7XTA",
        IF(ISPICKVAL(Flat_Status__c, "Sold"), "sfc/p/7F000002d9r8/a/7F000000km5q/T1PrjOchBhaa8g6y4rblKKF3itcbJeVQHLXFJtYhylg",
        IF(ISPICKVAL(Flat_Status__c, "Available"),"sfc/p/7F000002d9r8/a/7F000000km5v/0LoKHqPA94j23Mx16HQ4077vpyz7i2hLE2z1HvVkkIg",

error says - Error: Syntax error. Found ')'

Can someone please help

               upload image in static resource resourse . and then file open --> view file  then copy url.   for example
 url may be https://ap1.salesforce.com/resource/1329402101000/Image1 
 then edit the url like this  ' /resource/Image1'  . Make the  formula in  below given format
IF( ISPICKVAL(Active__c, "Yes") , IMAGE("/resource/yes", "yes"), IMAGE("/resource/no", "no") )

Hope this helps


Deepali KulshresthaDeepali Kulshrestha
Hi Manjunath,

ISPICKVAL function accepts two parameters - the picklist field name and the picklist value against which it will match the current value.

For your case - you will need to use a nested if formula.

Something like this

  IF(ISPICKVAL(Contact_Status_Data__c, "Active"), "img/msg_icons/confirm32.png",
      IF(ISPICKVAL(Contact_Status_Data__c, "Inactive"), "img/msg_icons/error32.png",
          IF(ISPICKVAL(Contact_Status_Data__c, "Non-Serviced"), "img/msg_icons/warning32.png"),

Or you can also try out the case formula that will be much more easier

"Active", "img/msg_icons/confirm32.png",
"Inactive", "img/msg_icons/error32.png",
"Non-Serviced", "img/msg_icons/warning32.png",
"No Volume", "img/msg_icons/info32.png",
"contact status")

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
Sprutiraj Panda 7Sprutiraj Panda 7
Deepali  Suppose There are 3 diff Picklist value is there on that cae what is the formula used 
& that 3 image also came on at a time