how to trigger a scheduled job in the flow

Not applicable

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 ?

 

3 REPLIES 3

Animesh Das2
Giga Sage

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

Ankur Bawiskar
Tera Patron

@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.