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
Ram chowdaryRam chowdary 

Stop batch process and automatically jump to finish() function

Good Evening,

I have created a batch process and inside the execute function, there is a condition. If a condition is meet, I want to stop the batch process and then call another batch process.

What i did at the moment is that I put System.abortJob() function. And call the batch process in my finish function. But when the condition is meet, the abortJob() will also stop the finish function being called therefore i won't call the other batch. I also try to call my other batch before the abortJob() but I will get an error that I cannot call a batch process inside the execute function. What is the other way to fix my problem ? please help.

Thank you...