Scheduling a backend workflow using Trigger to make it synchrocus. Does that work?

I am using the Toolbox plugin to run JavaScript and store the returned JSON as text inside the database.

Here is the flow:

  1. Button clicks.
  2. Run JavaScript and store the response in a state.
  3. Pass the state to a backend workflow.
  4. Backend workflow updates the database.

Steps 2 and 3 are executed in their own Custom Events to ensure they are synchronous.

The issue is that the value stored in the database is empty on the first try. However, when I retry, the value is successfully stored.

Could it be that Run JavaScript takes more time to execute, causing the backend workflow to trigger before it’s completed?

The better way is

  1. Button click > Run Javascript (your script must pass your result to a JavaToBubble Element bubble_fn_J2BnameHere(value))
  2. Use the “JavaToBubble Event” trigger to pass it’s value to your backend WF.

Make sure to check the appropriate boxes in the JToB element.

1 Like

Thanks.
Yeah, I actually had to use the Javascript Event to capture the output from javascript and then perform next actions.

1 Like