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
sfdc development hintssfdc development hints 

Hi , can anyone help me out with the scheduler class on my requirement

Hi,

 

 I have a field called as status in the case object and another field called as substatus(dependent field of status) in my case object, so whenever i assigned the status field to following values such as "Assigned","In Progress" , and "Reopened" , the value of sub status changes to "Pending" for which the following field

 

"UAT Release clock" shoulkd be updated to 1 , if the value of sub status remains same as "Pending" with a period gap of 1 day, if the status is changed to other values apart fom those 3 values then the value of the field "UAT Release clock " should remain 0 ,

 

i tried implementing these logic using a workflow , which was working on the same day , but since my requirenment depends that the change with a period of 8 hours , i need to write a scheduler class for implementing this logic, can anyone help me out with this please...

Navatar_DbSupNavatar_DbSup

Hi,

 

You have to simply write all the logic inside the schedule class. It’s like a simple class that implement scheduling and you have to write all the logic inside the execute method.

Try the below code as reference:

 

global class getStockPrice implements Schedulable

{

global void execute(SchedulableContext ctx)

{

// put for logic here.

}

}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

sfdc development hintssfdc development hints

can the above requirement be achieved by using a time based workflow , so that i can write a field update for field UAT Release clock like(PRIORVALUE(UAT RELEASE CLOCK+1), which tends to increment the field by 1 with the prior value based on the entry criteria specified by me , is that  possible ?

Navatar_DbSupNavatar_DbSup

Hi,


You can’t write a time based workflow for every time record is created or edited i.e. 3rd option. You can use time based workflow for every time record is created i.e. 2st option or Every time record is created or edited and didn’t previously meet the rule criteria i.e. 1st option.