Prevent new scheduled API workflow from running until another is complete

I have two API workflows that delete lists of data recursively. I’m trying to think of a way to prevent the user from hitting the respective delete buttons too soon after one another which can cause capacity issues. Is there an only when condition that can achieve this?

I would generally handle this with a database field. Since your recursive workflows happen on the backend, they need a way of informing the front end page UI of their status. Database fields are a great way to handle this. Here are the basic steps:

  • Create a database field called “[WorkflowName] Complete?” where “[WorkflowName]” is the name of your specific workflow (in case you end up with more than one of these fields). I generally put this field on the user data type for ease of use, but in theory it can go anywhere.
  • When triggering the workflow for the first time, set this field to no.
  • On the backend workflow, add an action to update this field to yes but only when the recursive processing has finished.
  • Back on the front end, create a condition on your button that says “only when Current User’s WorkflowName Complete is no → the element isn’t clickable”

That should prevent any users from clicking the button while any ongoing processing is occurring.

1 Like