I’m using the Toolbox plugin and the JavascriptToBubble feature. I want to click a button and save the value processed by Javascript to a database, so I’m currently implementing it as follows.
- Click the button
- Button workflow step 1: Register the result of the calculation in Run Javascript to “JavascripttoBulle A” using bubble_fn_name
- Button workflow step 2: Create a new SampleTBL, specify “test = JavascripttoBulle A’s value” and save to the database
However, the value is not saved to the DB unless the button is clicked twice (the first push saves a blank to the DB, and the second push saves the value to the DB), or there are separate buttons for “processing with Javascript” and “saving to DB.”
Is there a good way to click a button once and then process the values in Javascript and save them to the DB?
Any help would be appreciated.
Enable Trigger Event for that J2B element and then use that trigger event to run your step 2 instead.
The issue is timing. You’re sending an empty value because the J2B element has not received the value. After the first click you’ll be able to see in the debugger that it does have the value. Using the Trigger Event ensures that the J2B value has received it’s values first before continuing the WF.
2 Likes
Hi,ihsanzainal84
Thank you for your reply.
I created a custom that specifies “test = Javascript to Bullet A’s value” and saves it to the DB, and set the Trigger event to step 2 of the work flow. However, when I clicked the button once, a blank was saved to the DB. I have attached the actual work flow that I set, so I would appreciate it if you could tell me the reason why the data is not saved correctly in the DB. Also, could you tell me if there are any other solutions?