# Some way to use Javascript in workflow to execute some code once

**URL:** <https://community.glideapps.com/t/some-way-to-use-javascript-in-workflow-to-execute-some-code-once/79488>\
**Category:** Ask for Help\
**Created:** [January 24, 2025, 4:00pm UTC](https://community.glideapps.com/t/some-way-to-use-javascript-in-workflow-to-execute-some-code-once/79488 "2025-01-24T16:00:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Romieux](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/_romieux/32/83089_2.png) [@\_Romieux](https://community.glideapps.com/u/_Romieux)\
**Post date:** [January 24, 2025, 4:00pm UTC](https://community.glideapps.com/t/some-way-to-use-javascript-in-workflow-to-execute-some-code-once/79488/1 "2025-01-24T16:00:41Z")

</div>

Hi  
I need to run some JavaScript code during a new form entry, but not as a column. I use a two-step workflow (initial form to gather responses and then complete in step 2 with comments). I want to execute JavaScript at the end of step 1 and after completing step 2, but the workflow doesn’t provide this option. Any workarounds?

 ![Capture d’écran 2025-01-24 à 16.51.06](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/a/ca7ab91d86d242d6ab822fef4fceb2b298730935.png)

---

<div class="post-metadata">

**Author:** ![MaximeBaker](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maximebaker/32/80877_2.png) [@MaximeBaker](https://community.glideapps.com/u/MaximeBaker)\
**Post date:** [January 24, 2025, 4:20pm UTC](https://community.glideapps.com/t/some-way-to-use-javascript-in-workflow-to-execute-some-code-once/79488/2 "2025-01-24T16:20:06Z")

</div>

You could still create the JavaScript column to run the JS you want before submitting, and then use the result from that JS column in your workflow.

But I think I know what you are trying to do… You want to use fetch 😏 right?

---

<div class="post-metadata">

**Author:** ![\_Romieux](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/_romieux/32/83089_2.png) [@\_Romieux](https://community.glideapps.com/u/_Romieux)\
**Post date:** [January 24, 2025, 4:40pm UTC](https://community.glideapps.com/t/some-way-to-use-javascript-in-workflow-to-execute-some-code-once/79488/3 "2025-01-24T16:40:10Z")

</div>

I’m unclear about something. When you add JavaScript to a column, it runs for each new row in the table, causing all rows to execute again. I can observe that every input row reloads the JavaScript, affecting the app. I haven’t tested it enough (no time to devtools). I’m not using fetch, but rather direct JavaScript and QueryJson, which are similar. 😇

---

<div class="post-metadata">

**Author:** ![MaximeBaker](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maximebaker/32/80877_2.png) [@MaximeBaker](https://community.glideapps.com/u/MaximeBaker)\
**Post date:** [January 24, 2025, 4:44pm UTC](https://community.glideapps.com/t/some-way-to-use-javascript-in-workflow-to-execute-some-code-once/79488/4 "2025-01-24T16:44:51Z")

</div>

Ok so what would you want to do with the workflow to the layout?

---

<div class="post-metadata">

**Author:** ![\_Romieux](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/_romieux/32/83089_2.png) [@\_Romieux](https://community.glideapps.com/u/_Romieux)\
**Post date:** [January 24, 2025, 5:04pm UTC](https://community.glideapps.com/t/some-way-to-use-javascript-in-workflow-to-execute-some-code-once/79488/5 "2025-01-24T17:04:53Z")

</div>

Implement a two-step form entry. Between Step One and Step Two, use JavaScript (fetch) to call additional information. Consider adding an optional step via JavaScript, possibly by creating a single-row extra table.

---

<div class="post-metadata">

**Author:** ![MaximeBaker](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/maximebaker/32/80877_2.png) [@MaximeBaker](https://community.glideapps.com/u/MaximeBaker)\
**Post date:** [January 24, 2025, 5:29pm UTC](https://community.glideapps.com/t/some-way-to-use-javascript-in-workflow-to-execute-some-code-once/79488/6 "2025-01-24T17:29:10Z")

</div>

Will the fetched data always be the same?

---

<div class="post-metadata">

**Author:** ![\_Romieux](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/_romieux/32/83089_2.png) [@\_Romieux](https://community.glideapps.com/u/_Romieux)\
**Post date:** [January 24, 2025, 5:56pm UTC](https://community.glideapps.com/t/some-way-to-use-javascript-in-workflow-to-execute-some-code-once/79488/7 "2025-01-24T17:56:31Z")

</div>

Same fetched point but non same var p1 or p2
