Are custom states set instantly?

I’ve got an issue that is driving me mad. I have a workflow that sets a custom state (let’s call it “This page’s prompt” and later uses it to make an external request).

But over and again, I’m running into that external API receiving an empty text instead of that state’s value. I’ve tried every trick, from debugging the workflow to putting a text in the UI to see if that state’s value is actually set, and it is, but the API is still sometimes receiving empty text.

Is it possible that the custom state takes some time to be set, and that the workflow does NOT wait for it to be set before firing out the API request?

The state should be instant. Are you running the api call on the same page that the state is on?

Yep. I actually found the issue, and it was related to the Toolbox plugin. I’m putting it hear in case someone will run into the same issue:

So I had a Toolbox JavaScript action that had to generate a certain text. To let the app “know” about the text that it generated, I had to use the “JavaScript to bubble” element and publish its value via bubble_fn_xxx within that javascript mentioned first above. After that, I would take the value from the workflow using “JavaScript to bubble A’s value”. The thing is, apparently the app doesn’t wait for bubble_fn_xxx to work, and, when it takes the JtB’s value, it’s empty.

Still trying to figure out what to do with this, but at least I now know where the bug is.

1 Like