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

Hello @Aki18 

 

Please accept the sequence of solutions that I have given, such that anyone who refers this will get complete solution and not be confused as the whole Link is pretty huge. .

 

Regards,

 

Shivalika 

 

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

 

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

 

Shivalika
Mega Sage

Hello @Aki18 

 

Please confirm if you checked my answer. Kindly mark my answer as helpful and accept solution if it helped you in anyway, so that it can move from unsolved bucket to solved bucket. 

 

Regards, 

Shivalika 

 

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

 

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

cOwNeE

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Aki18 

why not merge them? i.e. In single custom action call both the scheduled job

but execution of scheduled job is aysnchronous

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

Hi @Ankur Bawiskar ,

Thank you for your reply, but as I stated earlier, The Flow needs 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.

Hello @Aki18 

 

I hope you checked the solution I provided. Regarding sorting it by created at or after. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway, so that it can move from unsolved bucket to solved bucket. It will also help me to be recognized for the efforts invested. 

 

Regards, 

Shivalika 

 

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

 

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