Does custom workflow action trigger database trigger event?

According to Bubble Docs’ Database Trigger article, “One database trigger event will not trigger a second one, or itself”. The article instructs that “If you want to ensure that workflows started by a database trigger events do trigger secondary events, you can move the actions into an API workflow and schedule that workflow from the trigger workflow.”

My question is whether the technique to trigger secondary events is limited to API workflows or also applies to custom workflows. In other words, does a data change action in a Custom Event invoked from a Database Trigger workflow trigger the Database Trigger Event?

As far as I know, no. Custom triggers on pages are on the page and need the data value set during the page session so not really possible unless the user is in a live session and remains on the page, but there is no need to use the backend database trigger change for that to take place.

Very confusing overall to read.

Sounds like you are attempting to ask if a backend custom workflow which has an action to change data, will that data change cause a backend database trigger to fire, then yes. A backend database trigger will fire even if you make the change to the database via the editor itself I believe.

Thanks, @boston85719, for replying. I’m sorry my original question was confusingly phrased. Following is another attempt, with an illustration.

First of all, I’m only referring to backend workflows–not any on-page workflows.

In the example mocked up in the following screenshot, the Database Trigger event is triggered upon a change in the value of the “Flag” field on the User type. Imagine that workflow performs various actions, ultimately concluding with an action to toggle the User’s “Flag” value again. There are multiple options for performing that final action, illustrated by the 3 steps in the screenshot: #1, a data change action within the Database Trigger workflow; #2, schedule an API workflow that includes a data change action; #3, trigger a Custom workflow that includes the data action. I’m seeking to confirm which of these 3 options would re-trigger the Database Trigger event.

  1. Per the official Bubble documentation I quoted, #1 WOULD NOT re-trigger the Database Trigger event because the action is within a Database Trigger workflow.
  2. Per the official Bubble documentation I quoted, #2 WOULD re-trigger the Database Trigger event even though it is scheduled from a Database Trigger workflow.
  3. I understand your reply to confirm that #3 also WOULD re-trigger the Database Trigger event even though it is triggered from a Database Trigger workflow. Is that correct?

Yes, because the API workflow is a completely separate event.

Doubtful but never tried. You can probably work it out by setting up a simple test. It would easily lead to an infinite loop though.

Yes, my simplistic mock-up could easily lead to an infinite loop. In my real scenario, pertinent conditions would be in place on the original Database Trigger event so as to re-trigger only in desired circumstances.

Why “doubtful”? Is a Custom event not a “completely separate event” in the same way as an API workflow?

If I don’t receive a definitive answer in the forum from someone who has already tested or implemented, I’ll indeed try to devise a test and report back for others’ reference.

Well I’d argue no as the custom event is triggered by the backend workflow but I don’t have a definitive answer. Just depends how Bubble runs it behind the scenes (i.e is it like a variable that inserts a series of actions into a workflow, or is it a separate piece of code?)

1 Like

Thanks again for chiming in, @georgecollier. A rough-and-ready test confirms your assumptions.

Summary for reference:

  1. Data change within a Database Trigger workflow DOES NOT trigger Database Trigger events.
  2. Data change within an API workflow scheduled from a Database Trigger workflow DOES trigger Database Trigger events.
  3. Data change within a Custom workflow called from a Database Trigger workflow DOES NOT trigger Database Trigger events.

Here are screenshots representing the basics of my test.


image