Trigger a scenario when three previous scenarios have completed

Hi everyone,

Background Info

Scenarios #4, #5, and #6 run at 1:00AM. Scenario #7 runs at 2:00AM.

Scenarios #4, #5, and #6 can complete their run at different intervals, so #5 may finish first, followed by #6, and then #4. It varies and is unpredictable.

I can’t combine #4, #5, and #6 because they would go beyond the 45 minute runtime limitation.

Question: Is there any way I can have Scnenario #7 run when #4, #5, and #6 are completed?

Thanks!

If the three scenarios complete within 45 minutes, and the last scenario is scheduled to run one hour after the three started, then wouldn’t it already be guaranteed to run after the other three scenarios ended?

3 Likes

Hi @samliew !

Yes, you are correct. But let’s say, for example, I have several scenarios that complete in 5 minutes, but for some reason need to be in separate scenarios. I would hate to have to wait another 55 minutes for the next scenario to run.

I would say it might be time to re-engineer all of them a bit. But if not…

  • Change #7 to run on-demand instead of scheduled.
  • You can have scenarios 4, 5, and 6 each run a check to see if the other two are finished. If so, t hen run #7.

Or:

  • Change #7 to on-demand
  • Change 4, 5, and 6 to kick off #7 as their final step
  • Add a filter in #7 to not do anything unless 4, 5, and 6 have already completed.

Either way, for both, #7 needs to not be scheduled and you’ll need to employ something like a data store to keep track of when all 4 have completed for the day.

4 Likes

Thanks for the ideas @Donald_Mitchell ! Im experimenting with the following: when 4, 5, OR 6 ends its run, it will create a record in a Data store (adding a “1” to a field called “Flag”). It will then go through a filter to determine if the total number of records in the data store equals 3. If that is the case, it means that 4, 5, and 6 have completed, and then that particular scenario can send an email to trigger #7. It will also delete the flags from the Data store. Is there a better way? Open to suggestions, thanks!

If it works for you, that’s one way to do it.
Rather than send an email to a mailhook to trigger the other scenario, I’d just use an HTTP Make a Request to call the webhook trigger in the other scenario.

If you delete all the flags in the Data Store, what’s to keep everything from running again in the same day? To prevent that, maybe use the current date as the key in the Data Store and periodically clean up the Data Store.

3 Likes

Thanks. I took your wise advice and updated to using a webhook trigger. Scenario #1 starts the process and receives an email with a CSV. This is the primary trigger to the whole process, so it should only run when initiated at Scenario 1. I also reengineered a ton of it. I got it into 9 scenarios, and it now runs in about an hour instead of over the course of 3 hours. I am using a Data store to track when scenarios are completed, and if they equal 11, the next series starts up.