Javascript save variable in a custom state

Hello, I appreciate anyone who can help me.

My question is quite simple, (I think).

I have JS code that captured something important for my application in a variable, now I need to save the data from that variable in a custom state so that I can do some workflow to save this in my database.

I searched the WEB but I’m having difficulty implementing this. Can anyone give me an example of how I can do it?

hypothetical situation:
var ID = 123456789;

I want to save “123456789” to a custom state so that as soon as this custom state is no longer empty, I can start a workflow to save “123456789” to my database. But I don’t know how to call some javascript function to save this to a custom state.

Hey @icaro.i.a :wave:

You can use the toolbox plugin for this: Toolbox Plugin | Bubble

Simply, you will create a Javascript to Bubble element in the page with any name:

Then, in your custom HTML, do whatever calculation you need and then, you will call this function: bubble_fn_test (Whatever you named it above) - (I added a delay because otherwise, it doesn’t recognize the function):
image

And you will add a workflow and do anything:

If you want to check the details, here is the editor: Bubble Demos by Flusk | Bubble Editor

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

2 Likes

Thank you very much, you helped me a lot. I hope this thread helps other people.

God bless you, your company and your family.

This topic was automatically closed after 70 days. New replies are no longer allowed.