I’m running a backend workflow after the user clicks a button.
Several things are running in the workflow (db-actions) and I want to display an indicator (spinner or loading screen). So I created a custom state called “API finsihed?” (yes/no) and want to set this element to no if the user click the button to run the backend workflow. after finish the backend workflow should send a “yes”, so that I can switch the custom_state “API_loaded?” to yes to hide the spinning wheel:
If the user clicks the button, the spinner is switched to hidden. The backend wf is running correctly, but the custom state would not change to (finihed loading) ‘yes’.
Unfortunately, as there’s no way to return data from a backend workflow to the front end, there’s no simple way to do this in Bubble.
One (perhaps the most common) solution is to run it through the API Connector (or App connector) instead of using a Schedule API Workflow action. That way you can return the data to the front end, so you’ll know when it’s finished running.
Another option is to use the Backend workflow to make a change in the database somewhere (perhaps have a WF log datatype specifically for the purpose), and then listen to that change on the page in order to know when the WF has finished running.
What I find myself doing most of the time is creating a LOG data type to keep track of the backend workflow, its start and end times and a status field. So, in your case, log of backend activity can be used to communicate to the user if the workflow has completed or not.
Create a LOG, start the spinner and keep the spinner visible as long as the status hasn’t yet completed - this would probably be the easiest way to accomplish what you need.
What do you specially mean with “API Connector”? - What is this?
I created a backend workflow and run it with “run backend wf…”
how to deal with your idea?