Toolbox Plugin - Save Value of JavascriptToBubble to DB

I’m using the Toolbox plugin and the JavascriptToBubble feature. For some reason I can’t store the value it publishes to the database. I can see the value in a text element or in a custom state so I know the value is there and working, it just won’t save the value to the DB.

Any help would be appreciated.

please try to enable the trigger in the javascript to bubble element and use it to save the value maybe it will work

1 Like

Just enabled it. Do I need to do anything else or just try it in my workflow now.

This worked. I figured it out but had to tie a small hack in with your suggestion. Thanks for pointing out the trigger. Appreciate it.

@jobin.blancaflor @neilpierce I thought this question would be a good opportunity for a YouTube vid. Seems like you figured everything out but posting the video here too for anyone coming by this thread in the future! https://youtu.be/9jVEzPLRebI

7 Likes

I’m having the same problem.

I enabled the trigger option but still didn’t work.

@neilpierce what “small hack” did you do?

1 Like

I’ll ping you tomorrow on this when I’m at my workstation.

Hi man! Would you like to share with us how did you figure it out with the trigger? since i’m having this struggle now to save the value that i can console.log in the console but can’t store it in my DB or at least show it in a element using the bubble_fn_name.

Would appreciate the help a lot

So when you’re using Javascript to Bubble with the toolbox plugin you need to set the data on on an input element first and then save the data from the input to the database. It’s a workaround / hack to get it to work properly but it works.

2 Likes

There is a problem with this, it will not store in the database because the javascript to element result isn’t a string, it’s a function. Another hack that I did , that I think will be far more elegant and scalable is to make a plugin, add an action that does what you want and then use the action as a workflow in your application and then you can simply retrieve the result in the next step of the workflow.

  • Make a plugin
  • Go to actions, and select “server side” so it’ll return a value.
  • Add a return key for the value for it to be assigned to, make sure to fill out all required fields. (if you’re using a dynamic value make sure to select it).
  • Place the function within the code with in the code section toward the bottom . Then take the result and place it in a return object at the bottom of the init function.

example:

  1. set a return key to being text.
  2. Place code like the following with the result in the return object assigned to the key you’ve just defined.

Example code:

////Assuming you have set a return key and named it “result”

function(properties, context) {
** let foo = “bar” **
** return { **
** result: foo**
** }**
}

(don’t why it added all those asterisks lol)

  1. Then click “go to test app” or test app if you haven’t assigned your app as a test app for the plugin. Then in the workflows, place the action where you want it and you should be able to use the result in the next(s) as simple text or whatever data type is needed! :pray:t6: