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
Georgina11Georgina11 

Formula help - on image and last modified date?

I am having trouble with the below formula as it is date/time based.

 

I was hoping to use traffic lights, based on when the opportunity record has last been modified, to ensure that the opportunity is being updated regularly / highlight when they are not being updated.

 

 

I would like a green light to be dispalyed for the first 10 days , a yellow one to be displayed between 10 and 20 days and a red light after 30 days. I have tried with the below formula but it does not seem to work Can anyone help please?

 

IMAGE

( CASE

( LastModifiedDate,

NOW() -10, "/img/samples/light_green.gif",

NOW() - 20, "/img/samples/light_yellow.gif",

NOW() - 30, "/img/samples/light_red.gif",

"/s.gif"),

"status colour")

 

Thanks

Ajay111Ajay111

if( Electrical_Wiring_Safety_Expiry_Date__c - TODAY() > 60 , IMAGE("https://salesforce.com/servlet/servlet.FileDownload?file=01520000000MZPe", "Electrical safety certificate valid for at least 60 days", 20,70), if( Electrical_Wiring_Safety_Expiry_Date__c - TODAY() <= 60 && Electrical_Wiring_Safety_Expiry_Date__c - TODAY() > 30, IMAGE("https://salesforce.com/servlet/servlet.FileDownload?file=01520000000aQ1t", "Electrical safety certificate expires in 30-60 days", 20,70), IMAGE("https://salesforce.com/servlet/servlet.FileDownload?file=01520000000MZPj", "Electrical safety certificate expires in less than 30 days, or there is no certificate", 20,70) ) )

 

use your code like this.

 

Thanks

Ajay

(abhoraskarstpl@googlemail.com)

Georgina11Georgina11

Thank you for your response -

 

I have tried to re-write, using NOW as LastModifiedDate is a standard field created by Salesforce - and a date/time field - which I think may be the problem - but it does not work.

 

( if ( LastModifiedDate - NOW() > 30 &&  IsClosed  = false), IMAGE("/img/samples/light_red.gif"),
if ( LastModifiedDate - NOW()   <= 30 &&  IsClosed  = false), IMAGE("/img/samples/light_yellow.gif"),
if ( LastModifiedDate - NOW()   <= 10 &&  IsClosed  = false), IMAGE("/img/samples/light_green.gif"),"")

Ajay111Ajay111

( if ( LastModifiedDate - Today() > 30 &&  IsClosed  == false), IMAGE("/img/samples/light_red.gif":smileywink:,

 

 check this