Indicate finish of running backend workflow (loading/spinner-elements)

Hi all,

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:

My backend wf:

Here’s my spinning element:

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’.

Any ideas?

Best+many thanks in advance,
jupxi

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.

3 Likes

Yea this is a tough one.

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.

5 Likes

I just read an article about “App connector”. - Seems it is a solution to connect 2 apps and it seems that that is a ‘big thing’ to realize :wink:

Or I’m wrong? How to achieve it with this “connectors”?

Thanks,
jupxi

Personally, I’d just use the API Connector if you’re going to go down that route.

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?

It’s Bubble’s plugin for making API calls.

Instead of calling the backend workflow with a ‘Schedule API workflow action’, call the endpoint directly from the Api connector.

Cannot find it ?! :slight_smile:

Have you set up the API call in the API Connector?

Ahh, you mean this one:

I already have api calls for chatgpt tests, but how to achieve this with my own backend workflow? I don’t fully understand it yet.

Thank you so much :pray:

Just create an API call, and use your backend workflow as the endpoint.

Once it’s initialised (as an action) you’ll be able to use it in your workflows.

API CALL ACTION GET
URL: https://abcde.com/version-test/api/1.1/wf

If I click on initialize call, I’ll get a html result?!

please help me. what settings do I have to set?

Many many thanks,
jupxi

The URL needs to be the URL of the backend workflow.

1 Like

I read about @georgecollier’s tip about using the app connector, so I’ve personally been using that since and not using the API connector

3 Likes

You are really the best community worldwide !!!
Thanks a lot to @adamhholmes, who helped me out many times!
Best, Thank you!

1 Like

Just another question. Is it possible to create a progressbar indicator with this solution (using the API Connector)?

This is my current backend wf (triggered by API plugin):

Best,
jupxi