+ 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