• Carsen Huffman
  • 0 Points
  • Member since 2018

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1

I have three scheduled jobs chained, one of them must be scheduled only if it`s the first day of the month.

This way:

Update all the Accounts, ten Accounts at a time managing a custom setting to re-schedule Account update job from the last Id processed, when the last Account is processed, then custom setting is updated to null and begin Update Contacts job...

Update Contact job is identical to Update Account Job, including the same custom setting to divide the execution in ten Contacts execution and then..

I have if (today.day == 1) then schedule a third job which updates Products, when its finished Account update job is scheduled to the next day

else (a different day than 1) I schedule Account update job to the next day and previously, custom setting is updated to null.

Well, there was a mistake in this code (I didnt do it :) ) because in the case its day 1, i dont update to null the custom setting so next day Contact job will begin to process from the last processed day 1, but this is not the problem I want to solve, although I can discard it`s related to my main issue.

Last, but not least, the code executes inside try-catch, sending an email in case of exception.

Well, my problem began at January 1st, from that day to day 15, execution of Contact jobs processed more or less 500 records(over a total of 30000) and then stopped, WITHOUT updating the custom setting causing the next day the first contact processed was the last processed the previous day. Day one were processed the contacts of index 1 to 500, second day 500 to 1000, third day 1000 to 1234, cause there are 1234 contacts at all, where the implementation is supposed to process every Contact every day.

What I really can`t understand and makes me go crazy is that in case of any error, updating custom setting, contact, null lists, whatever, an email is supposed to be sent to me and there was no email sent so there was not error or (crazy) there was an email error each day from January 1st to January 15th

Any ideas would be apreciated, and, yes, next time I`ll look for a better solution than chained jobs.

Regards and happy new year everybody