function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RohithaSfdcRohithaSfdc 

I need help regarding formula field picklist values color code

Hi Friends, Thanks in advance,

I have Export (Emergency__c) custom object in that (Approval_Status__c) approval status is picklist field with values 'Approved', 'Rejected'.
Approved is green
Rejected is Red
I need to create formula field for this 
Status__c is formula field 
 
IF(ISPICKVAL(Approval_Status__c, 'Approved') , IMAGE("/img/samples/color_green.gif "),
IF(ISPICKVAL(Approval_Status__c, 'Rejected'), IMAGE("/img/samples/color_red.gif ")))

Thanks
Best Answer chosen by RohithaSfdc
Ravi Dutt SharmaRavi Dutt Sharma
Hey Rohita,

Try below formula, it should work for your case.
 
CASE(Approval_Status__c, 
'Approved', IMAGE("/img/samples/color_green.gif ","green"), 
'Rejected', IMAGE("/img/samples/color_green.gif ","red"),
"default")

 

All Answers

Ravi Dutt SharmaRavi Dutt Sharma
Hey Rohita,

Try below formula, it should work for your case.
 
CASE(Approval_Status__c, 
'Approved', IMAGE("/img/samples/color_green.gif ","green"), 
'Rejected', IMAGE("/img/samples/color_green.gif ","red"),
"default")

 
This was selected as the best answer
Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that will help you
1) https://help.salesforce.com/HTViewSolution?id=000007604
2) https://help.salesforce.com/apex/HTViewHelpDoc?id=useful_advanced_formulas_image_links.htm&language=en_US
3) https://developer.salesforce.com/docs/atlas.en-us.usefulFormulaFields.meta/usefulFormulaFields/useful_advanced_formulas_image_links.htm
Please try like below
IMAGE( 
CASE( text(Approval_Status__c) , 
"Approved", "/img/samples/flag_green.gif",
"Rejected", "/img/samples/flag_red.gif", 
"/s.gif"), 
"Priority Flag")

Let us know if this will help you