Forum Academy Marketplace Showcase Pricing Features

Javascript Toolbox: Getting a variable created from a function

Hi all,

I’m having an issue with returning a variable from a function using the toolbox plugin.

The setup is as follows:

  1. Function bubble_fn_a is created in the Javascript to Bubble element and the function is declared in an html element:


  2. A workflow uses the ‘Run Javascript’ action which runs the function:

  3. I’ve got an event listening for the function to run, and when it does it puts the function’s returned value (which should be the variable initiativeName) into the URL as a parameter:

However, despite the variable being correctly created, the final step never triggers and nothing happens despite the workflow being triggered.

Any idea why this is not running?

Thanks in advance!

Reece

Hi were you able to solve this issue?

The problem here is that the function’s created twice. The JavascripttoBubble creates the function bubble_fn_a() but then so the script in the HTML element.

The HTML element should be deleted all together and the code should be moved in the Run javascript action like this:

var initiative = "Table/grid initiative's Clicked row data";
bubble_fn_a( initiative.split(",", 1) );

This will effectively call the JavascripttoBubble function, passing it the extracted name along and the element will call the workflow to set the URL parameter.