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
shan jakkulashan jakkula 

shedule apex class to delete 1 day from due date

Hi all,
I need to write a script( in developer console)  to delete one day from due date filed and it has needed to schedule run everyday @ 11:59 pm.

Based upon the due date only my aging Buckets values populate. so i need to remains the same due date for every day.

please anyone could help me. its urgent.  THANKS IN ADVANCE

shanmuka
Ashish_SFDCAshish_SFDC
Hi Shanmukha, 


Which date you do not want to include?

You can add a for loop container above the code which has the criteria if date != XXXX then process the class. 


Regards,
Ashish
shan jakkulashan jakkula
i have a due date field, day past due(DPD) fields. due date-today =  DPD.
ex: if due date = 31-03-2014 then DPD is 91.
By tomorow system date increases 1 day, so DPD comes to 90.  
But i need to maintain 91 days as DPD constantly, so that i need to deduct 1 day from due date.

could you please help me in this. i'm not at all good at coding.
Amit G KumarAmit G Kumar
Hi Shan,
               I didn't fully understood your last comment where you mentioned "By tomorow system date increases 1 day, so DPD comes to 90." i think DPD for tomorrow will be 92 but you want to mantain it to 91.

Coming to the way how to deduct one day from Due date if below snippet of code.
Assumption Task Due Date.

Run batch on all Task which have Due Date and then update them with below line of code.
List<Task> = get the batch of records which needs to be corrected
for(task t : taskList){
   task = task,DueDate - 1;
}
update taskList;

*Remember this will show Modified date and Modified by each time by person who schedule that batch.

If this solves your question then accept the Answer. Thanks