Scheduled Workflow Run targeting the same Workflow

I have a need to run a certain workflow repeatedly at a certain interval until an Event gets acknowledged or resolved. The interval varies depending on the type of the event. I am attempting to use the “Scheduled Workflow Run” feature to do this.

The initial run of the workflow is scheduled from another workflow that creates the event. This works as expected, and when the workflow runs, it checks the state of the Event. If the Event is still in a ‘new’ state, it performs some actions and then attempts to schedule itself in the future using the same interval.

However, when the Workflow Node with the “Schedule or update a future run” option set, which has the Workflow and Virtual Button referencing the same workflow again, executes, it is generating an “InfiniteLoopError - Workflow Reentrant Loop for Button Run” which is accurate aside from the fact that it isn’t infinite since the Event will eventually be acknowledged or resolved and the workflow will no longer get scheduled to run again in the future.

This seems like something that should be allowed, although I can see why the error exists especially as it likely predates the Scheduled Workflow Run feature, which is relatively new. My question, nonetheless, is “what is the suggested work-around to re-schedule another run of the same workflow at some future time?” I’ve considered trying multiple workflows - ping-ponging between them if you will - but I am concerned the loop detection logic may see through that and give the same error. Is there a known way around this?

You have the right idea. The workaround is two Virtual Button Triggers and two Workflow Trigger Nodes alternating. I’ve attached a proof of concept workflow demonstrating this. You’ll just need some way of identifying in your workflow run which trigger fired the current run and make sure to switch to the other in the output.

ping-pong-develop.flow (3.8 KB)

1 Like

Two alternating virtual buttons does the trick, and is better than two distinct workflows. Thanks Dylan!