I have created a chain of batch classes (5 batch classes calling each other) and everything working as expected. After this is deployed in production, to do a real time testing and debugging for future enhancements, I replicated the entire batch process and the custom objects involved in the original batch. Lets say the original batch is called abc and it insert/update/delete records in a custom objects called xyz and to do these dmls, standard objects like orderproduct, workorder, etc are involved.

To duplicate the process, I created another object called xyz-test, replicated all the batches, and suffixed -testing to their names (abc-testing). Also, I made sure that instead of the original object, the test object is referred in this batch chain.

I scheduled both the batches at the same time. But both are returning different results. The test batch is not working as the original batch. Is there anything I am missing?

  • test batch is not working as the original batch what do you mean by not working! Can you be more specific? Nov 29, 2018 at 16:53
  • I meant its not working as the original one. I updated the title. Nov 29, 2018 at 17:13
  • 1
    We're going to need more information to go on. You can't just say "it's different" or "it's not working." That could mean almost anything. The more information you give us, the better we can help you. Describe how it's different. What are the expected results, versus what did you see? You might even want to actually share your code, it may be that we can spot the differences.
    – sfdcfox
    Nov 29, 2018 at 17:28
  • Its a total of 10 classes and I am not sure if I can post here all the 10 classes. Here are the differences : Nov 29, 2018 at 17:36
  • Here are the differences : The batch is suppose to insert records on the abc object based on various criteria from order product. The original process returns 98k records, while the duplicate other returns 94K. Post this, the other batches, based on many criteria, are suppose to stamp these abc and abc-test records. Even stamping is not in sync AND there is no difference in the logic. Nov 29, 2018 at 17:42

1 Answer 1


I found the reason. Records were getting locked by the first batch and as a result, the other batch was not considering those records.

  • How you handeled it? Might worth adding to this answer Dec 6, 2018 at 21:15
  • I scheduled both the processes with a gap of 1 hour. Dec 11, 2018 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .