Forum Academy Marketplace Showcase Pricing Features

Check if a scheduled workflow has run

It would be cool if you could check if a scheduled workflow has been run.

An example: A user selects some items in a repeating group and performs an action on all these. The only way to implement this is to run “Schedule API Workflow on a List”, and that works fine, except that it is not possible to provide a “loading” state feedback to the user, as you don’t know when the updates have finished. If you could ask Bubble if specific workflow has been run, it would be possible.

This would be very useful. I wonder if Bubble would be open to exposing a status field on API workflows, so that we can query whether they have been completed or not (regardless of whether it completed successfully or with an error).

I’m in a situation right now where I need to check the status of a workflow to prevent users from triggering a second workflow on the same list until after the first workflow is finished:

  • Repeating group has a list of customers (“Customers to Collect from”) with a $ amount next to each customer’s name
  • User clicks “charge customers” and API Workflow #1 is run
  • (ideally the “charge customers” button will be hidden until Workflow #1 is completed, but Bubble does not currently expose a way to check the workflow status, which would be used to conditionally make the “charge customers” button visible/hidden)
  • As workflow#1 runs, customers are charged and subsequently disappear from the Repeating Group
  • On long lists, the User begins to get annoyed because workflow#1 is taking a while (names are not disappearing fast enough from the Repeating Group) and the user clicks the “charge customers button again”, which then schedules another workflow on the remaining list of customers that have not yet been processed
  • …this process continues and customers are accidentally charged multiple times via workflows that should not exist until workflow#1 is complete (or terminated due to an error).

Without being able to query a workflow’s status, it seems like Bubble may be currently limited in its capabilities for bulk task automation. Maybe I’m missing something? I wonder how @natedogg deals with this on his financial app?

In the past, when I’ve had to do something similar to what it sounds like you’re doing, I’ve just created a dummy field that changes to true if a specific workflow has run on it, and filter a repeating group by that field. You could hide the button until the repeating group’s list is empty. Probably not ideal, especially if you plan on re-running the same workflow later or if the list is really big.

Honestly, I don’t have another solution than that. Many of our daily workflows are recurring events, or triggered by webhooks.

3 Likes

Thanks for the quick reply @natedogg - great idea, using a dummy field seems like the way to go. If the dummy field is not empty, we can have the workflow skip over it via a conditional so that having the same customer charge inside of multiple workflows won’t matter so much from a UX perspective.

For the button, I’m thinking to store the repeating group items as a page state when the button is triggered. This would allow the button to remain dependent on the dummy fields of the items inside of that list unless the user refreshes the page.

Bubble and clever workarounds to the rescue again…we’ll make it work :metal:

a little late but if someone finds this, i just fond a solution, if there is an oficial way of doing this then let me know.

i basically add a field on the element passed/used to the background element, a yes/no, then add set that element to a state on the page that calls the Backend event, add a custom event that is triggered when tath state element is changed to yes, at the end of the backend workflow change the value to yes and the custom event on the pages is triggered