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
sfdclearnsfdclearn 

Trigger to check if the date is passed 60 days from the previous value

Hi ,

 

 

   I am writing a trigger that changes the picklist value based on a date field.

 

     I have a date field called renewal_date__c and if this date passes 60 days from this value then the picklist value should go to 'Declined Support'. Any suggestions on how this can be achieved?

 

Thanks!

Anup JadhavAnup Jadhav

Assuming renewal_date__c is a Date field, you can do this for comparision:

 

if(renewal_date__c > Date.today().addDays(-60)) {
   // do something here
} 

 

Hope this helps!

 

- Anup