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
AmitSahuAmitSahu 

Schedule is not working as expected

Hi Guys,

 

Any one can have any thoughts on this issue please?

 

I have a schedule to run everyday at 12:00 AM. So It runs everyday.

 

The problem is, if the schedule updates the records one day it does not do that the other day.

 

My code was running properly until the scheduling user was changed.

 

What does the code do ?


The code queries on an object and gets records created today and creates the same records in another object.

 

Example: The Cases are queried and cases created today are fetched and stored in another object.

 

The same code was working perfectly fine since recent past. The user who scheduled this initially is inactive now. So it schedule was put in back using other user (System Admin).

 

Since then the schedule runs daily. But, one day it does what it supposed to and on the other day it just runs till the query and does not create the records in the target object.

 

.....

HariDineshHariDinesh

Hi,

 

For confirmation,

Did you checked is there any newly created validation rules in Target object?

That might be the reason for not creating records in Target object.

 

If there is nothing like that, just try to create some records of that object through developer console using the same code.

This might give you some idea with Debug Logs.

 

If above things does not works, then try to create another scheduler to run right now and try to find what happening from debug logs.

 

These are the thought currently I have.

AmitSahuAmitSahu
Hi Hari,

Thanks for your reply on this.
I have already tried these things :
1. Created another scheduler by deleting the current one.
2. If there were any newly created VR, then the schedule will always fail not on alternate day. By the way there is no validation rule on that.
3. Already tried the code in Dev Console and perfectly fine ....
4. If I create the schedule that works on that day .So if I will create schedule today, tomorrow and day after tomorrow that will work fine. But otherwise it will run today, fail tomorrow and will be a success on day after tomorrow.

I already tried setting up the Debug Log for the user who scheduled the job, All I have is the logs is there till the query execution line and nothing after that.
HariDineshHariDinesh

Hi,

 

You tried all ways which are in my mind.

I worked on Scheduler few times at my work. But I did not face this type of issue.

 

Let’s see any Board member faced these types of issues or can help us to understand what’s happening there.

 

 

Yinfeng GuoYinfeng Guo

I meet the same problem recently, do you have solved this problem now? 

AmitSahuAmitSahu
Yes, Salesforce support did not help me :( . But thank god it's fixed for now...