Calling a flow from a scheduled job

Andrew158
Giga Guru

Hello everyone,

 

I have a requirement to create a flow that executes twice a day at 7am and 7pm. As you cannot create such a trigger in the flow designer, I am trying to call my flow from scheduled jobs that are set to execute at those times. I have never used the REST API trigger in a flow before and am running into some trouble. Below is the trigger and Code Snippet from the flow designer:

Andrew158_0-1681157593372.pngAndrew158_1-1681157621609.png

And here is my scheduled Job:

Andrew158_2-1681157742815.png

When I execute the scheduled job, the flow does not execute. It is worth noting that I commented out the inputs from the code snippet as it contained syntax errors. Also, I have no need for inputs for my flow (Although this may be a misunderstanding on my part for how the REST API trigger works). How can I get my flow to execute from the scheduled job?

Thanks in advance,

Andrew O'Connor

1 ACCEPTED SOLUTION

Andrew158
Giga Guru

Just wanted to give an update since I found a solution to this issue. My solution was to have the flow trigger daily at 7pm, then create an additional scheduled job that triggers at 7am, which calls a script include that runs the flow (see below).

 

Scheduled Job:

Andrew158_0-1682111291100.png

Script Include:

Andrew158_0-1681848171541.png

 

View solution in original post

3 REPLIES 3

Brian Lancaster
Tera Sage

According to this KB Article you should create a subflow and call it. Looks like the code is startSubflow and much simpler then the code you are using. Also I would change the schedule job to run periodically repeating every 12 hours starting at 7 AM.

 

BrianLancaster_0-1681189890236.png

 

Andrew158
Giga Guru

Just wanted to give an update since I found a solution to this issue. My solution was to have the flow trigger daily at 7pm, then create an additional scheduled job that triggers at 7am, which calls a script include that runs the flow (see below).

 

Scheduled Job:

Andrew158_0-1682111291100.png

Script Include:

Andrew158_0-1681848171541.png

 

Instead of providing screenshots of the code can you provide the code itself. This will make it easier for other users that may have the same issue and you may get more helpful responses.