+ Start a Discussion
Shawna.ax1585Shawna.ax1585 

Image Formula Field for colored flags - Need Help!

I am trying to write a formula that says, if the "One Year from original contract date" field is less than today then display the green flag; otherwise display the red flag.

 

The One year original contract date field is a date formula field (Original_Start_Date__c + 365). 

 

This is what I've written so far but it's not working.  Can someone help me?

 

IMAGE (
IF ( One_Year_from_Original_Contract_Date__c < TODAY()),"/img/samples/flag_green.gif",
"/img/samples/flag_red.gif" )

Best Answer chosen by Admin (Salesforce Developers) 
@anilbathula@@anilbathula@
Hi Shawna,

Try this formula in your formula field:

IMAGE(IF ( One_Year_from_Original_Contract_Date__c < TODAY(),"/img/samples/flag_green.gif" ,"/img/samples/flag_red.gif"),"Red")

All Answers

@anilbathula@@anilbathula@
Hi Shawna,

Try this formula in your formula field:

IMAGE(IF ( One_Year_from_Original_Contract_Date__c < TODAY(),"/img/samples/flag_green.gif" ,"/img/samples/flag_red.gif"),"Red")
This was selected as the best answer
Shawna.ax1585Shawna.ax1585

It worked!  Thank you, can you explain why the "red" is at the end of the formula? I don't understand that. 

imutsavimutsav
image formula syntax :
IMAGE(image_url, alternate_text, height, width)

Thanks
Utsav