Want Run Schedule Jobs in Sequence one after other job
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 10:10 PM - edited 02-26-2024 10:56 PM
Hi All,
I had a requirement to run schedule job one after another in the Sequence. i had 6 schedule jobs as now. i want run in sequence see below logic how i need. please let me how i can achieve this.
Once Schedule job A run completes then Schedule job B should run
Once Schedule job B run completes then Schedule job C should run
Once Schedule job C run completes then Schedule job D should run
Once Schedule job D run completes then Schedule job E should run
want know how we can achieve above logic..? Thanks
Thanks & Regards
Mannam Praveen Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 04:40 AM
Hi!
The very nature, and the power, of the scheduled jobs lies in their asynchronicity. As such, you wouldn't expect them to create chains that you describe. If you think about it, the fact that they're "scheduled" takes for granted that you schedule them ahead of time, to be ran at a specific time.
That being said, technically you can achieve the result you're looking:
// first, grab the sysauto_script record for the job
var JOB_ID = '';
var jobGR = new GlideRecord('sysauto_script');
// now, run the job using the same mechanism that's used in the OOB "Execute Now" UI Action
if (jobGR.get(JOB_ID)) {
SncTriggerSynchronizer.executeNow(jobGR);
}
However, I'd recommend against that. Perhaps you could consider a series of Script Actions that would execute one another by throwing an event leading to the next one. This assumes that, for any reason, doing the same with a single piece of code is not feasible.
Please mark this response as useful and the question as solved if the issue has been solved. Thank you!