how to trigger a scheduled job in the flow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 07:58 AM
I have an otb schedule job which runs daily. I had a requirement where the the scheduled job should execute from flow based on some conditions.
can anyone help me how to trigger a scheduled job inside the flow ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 12:22 PM
Hi @Community Alums
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 02:04 AM - edited 02-25-2025 02:06 AM
Hi @Community Alums ,
You can create a custom flow action having 'Script step' in it and in that script you can put below lines. Then just use that new action inside your flow.
var job = new GlideRecord('sysauto_script');
job.addQuery('name','That Schedule Job Name');
job.query();
if (job.next()) {
SncTriggerSynchronizer.executeNow(job);
}
If this address your question, please don't forget to mark this response correct by clicking on Accept as Solution and/or Kudos.
You may mark this helpful as well if it helps you.
Thanks,
Animesh Das
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 02:14 AM
@Community Alums
what's your requirement to run scheduled job from flow?
You will have to use custom flow action and then use this script
var jobRecord = new GlideRecord('sysauto_script');
jobRecord.addQuery('name', 'Schedule Job Name');
jobRecord.query();
if (jobRecord.next()) {
gs.executeNow(jobRecord);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader