# Saving javascript output to DB

**URL:** <https://forum.bubble.io/t/saving-javascript-output-to-db/370922>\
**Category:** Database\
**Created:** [May 27, 2025, 4:25pm UTC](https://forum.bubble.io/t/saving-javascript-output-to-db/370922 "2025-05-27T16:25:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul46](https://avatars.discourse-cdn.com/v4/letter/p/e19adc/32.png) [@paul46](https://forum.bubble.io/u/paul46)\
**Post date:** [May 27, 2025, 4:25pm UTC](https://forum.bubble.io/t/saving-javascript-output-to-db/370922/1 "2025-05-27T16:25:08Z")

</div>

Hi,

I’m unable to save a JavascriptToBubble’s value to the DB.

1. Debugger shows the values are calculated
2. Debugger shows a new thing is created with the calculated values
3. For a short notice the calculated values are shown in a table element
4. When I go to the Database OR refresh the page, the values are all gone.

I have simplified the calculations down to the simplest Workflow without any dynamic values in the Javascript. The issue seems to be revolving around JStoBubble element.

When I click “save” the second time, it saves the values to the DB but now it also created a new thing.

Workflow step1:

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/b/3/b3a51d27182f20fb4ee55d958bc71dccf406db7c.png)

Workflow step2:

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/7/d/7de72a4cc939fdc3a289a75ba181d9d0b4d5e088.png)

Debugger showing a successful “Create a new thing” with the right value. Yet DB ends up empty.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/0/d/0db046b63ca0b9826df3f22e725e1af0cdf26916.png)

I searched the forum, found the same issues without solution…

---

<div class="post-metadata">

**Author:** ![ademiguel](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ademiguel/32/245027_2.png) [@ademiguel](https://forum.bubble.io/u/ademiguel)\
**Post date:** [May 27, 2025, 4:32pm UTC](https://forum.bubble.io/t/saving-javascript-output-to-db/370922/2 "2025-05-27T16:32:03Z")

</div>

I suspect the thing is being created before the calculation result is ready.

Debugger can be showing the thing being created with the provided value but it isn’t always true…

Try placing a long pause between or taking the `Run Javascript...` action to a Custom Event to rule this in/out.

---

<div class="post-metadata">

**Author:** ![paul46](https://avatars.discourse-cdn.com/v4/letter/p/e19adc/32.png) [@paul46](https://forum.bubble.io/u/paul46)\
**Post date:** [May 27, 2025, 4:38pm UTC](https://forum.bubble.io/t/saving-javascript-output-to-db/370922/3 "2025-05-27T16:38:21Z")

</div>

Tried adding a pause, it did not make a difference

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [May 27, 2025, 4:54pm UTC](https://forum.bubble.io/t/saving-javascript-output-to-db/370922/4 "2025-05-27T16:54:30Z")

</div>

Use an event triggered by the JavaScript to bubble element.

---

<div class="post-metadata">

**Author:** ![paul46](https://avatars.discourse-cdn.com/v4/letter/p/e19adc/32.png) [@paul46](https://forum.bubble.io/u/paul46)\
**Post date:** [May 30, 2025, 7:10am UTC](https://forum.bubble.io/t/saving-javascript-output-to-db/370922/5 "2025-05-30T07:10:32Z")

</div>

Thanks, it worked!
