How to make Flow execute multiple Scheduled Jobs in correct order?

Aki18
Tera Contributor

I created a custom Flow. The Flow calls custom Action that calls the Scheduled Job (A) to execute, using "

SncTriggerSynchronizer.executeNow()" method.

What I would like the Flow to do next is to call another Action to execute another Scheduled Job (B).

The important thing is to consider the sequence. Only after the first Scheduled Job (A) is completed, the next one (B) needs to work.

Please let me know how to achieve this.

*I tried to make the Flow check the "sys_trigger" record, but looks like its state is always "ready", so I think the Flow can't recognize the Scheduled job's completion.

 

Best Regards,

Aki

1 ACCEPTED SOLUTION

Hello @Aki18 

 

That's the purpose of whole your requirement right ? If the scheduled job A is failing and you are not finding any logs, why would you proceed with scheduled job B. 

 

look at the below picture - 

1000020927.jpg

 

This job was created by me and it's running per flow designer and it creates record only when completed. FILTER I TOLD WAS TO SORT IT Z TO A AND CREATED AT OR AFTER. 

 

You won't be getting more records like that. 

 

1000020928.jpg

 

See how I added filter and I am not getting records. So just add the created filter in such a way that it brings only one record. I am sure there wouldn't be 10 other flows running this job so you won't be confused in multiple records. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY.

 

View solution in original post

16 REPLIES 16

@Aki18 

Make it simple and don't complicate. Do this

1) create normal flow

2) create 1 custom action and add it in flow instead of calling scheduled job from script, use the job script in Script step of Custom action

3) create 2nd custom action and do the same

Now when your flow runs the 1st custom action will run and once the script completes the 2nd action will run as it's after 1st custom action

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

wavetom5
Giga Expert

as shivilika said: You can check the scheduled job completion in syslog_transaction table.