Triggering frontend actions from backend workflow results — best practice?

What’s the best pattern to trigger frontend actions after backend workflows finish?

Typical flow:

  • User clicks a button on front

  • Backend workflow runs and updates the database

  • Frontend must react: redirect to external website

A lot of nights spent without good solution ))

2 Likes

I don’t know how to do it the best way possible, but when I needed answers like this I created a database field and within the flow I changed this field, then the page on the front has a workflow that is activated whenever that field is this value changed, then you have freedom to do the action you want on the front

2 Likes

Trigger a custom event when data changes.

4 Likes

Yeah, this is a common challenge in Bubble. The usual pattern is to have the backend workflow update a field on the thing it’s working on, for example, set status = done when it finishes. On the frontend, you can have a repeating group, group, or hidden element watching that field (via “Do every X seconds” or a conditional) and trigger your action like a redirect, once the field changes.

Another approach is to use custom states combined with API workflows: the backend workflow calls an API workflow that updates a custom state on the user or page, and then the frontend reacts to that state change. Bubble doesn’t have a direct “callback” from backend workflows, so these workarounds are usually the cleanest way to sync frontend actions with backend completion. Hope this helps.

1 Like

Change data field on backend, the front end workflow series scheduled backend workflow and triggers custom event on front end that is when data changes.

Don’t use custom states or conditional workflows or do when true or do every x seconds as was suggested.

1 Like

I think you need some kinda of watcher/transactions logic ( u need separate table) for long-running or async workflows.

1 Like

This is a bad approach and, if I’m reading it correctly, not possible in Bubble.

@nptne8 follow @boston85719 or use API connector if necessary…

2 Likes

I think what @connect10 might have been implying is that the backend workflow can be run via action API call to it, and the API call response that’s available as result of previous step can be used in subsequent action to navigate the user to other url. But if not, the way they wrote it, I don’t think is possible as you pointed out.

1 Like

Thank you @MattN @vinimotta2013 @boston85719 @code-escapee . I spent one week but solution is 5 minutes job with break ))))))

3 Likes

Perhaps but states don’t come into play…

1 Like

Perhaps consider this approach by @jamesdevonport