# Passing msg.payload into template node \<script\>

**URL:** <https://discourse.nodered.org/t/passing-msg-payload-into-template-node-script/92788>\
**Category:** General\
**Tags:** ui-template, uibuilder\
**Created:** [30 October 2024 11:54 UTC](https://discourse.nodered.org/t/passing-msg-payload-into-template-node-script/92788 "2024-10-30T11:54:03Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [30 October 2024 16:06 UTC](https://discourse.nodered.org/t/passing-msg-payload-into-template-node-script/92788/3 "2024-10-30T16:06:59Z")

</div>

> [@gregorius](#):
>
> that won't work

this IS working. the code is within `<script></script>` tag in the template node.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d425c1a49a0d3ffda6f494a12b2c1df98523c696.png)

> [@smanjunath211](#):
>
> ONOFF Table (array) is using array data within the template node (hard coded) and is working, the rows counts are dynamic, **but the data is static**

The only trouble is the data coming into this function is from a static data within the template. I want the static data wihtin the template node script tag to read from a msg.payload input.

I know the answer is in this thread, but i cant get it to adapt to my situation.  
the example works for me, i just can't adapt to my requirement.

> [@How to pass msg.payload to \<script\>\</script\> in template node of node-red-dashboard 3.6.5?](https://discourse.nodered.org/t/how-to-pass-msg-payload-to-script-script-in-template-node-of-node-red-dashboard-3-6-5/89255/7):
>
> You would use the second example in the side bar help for ui-template. You can then watch for incoming msg.payload. Example template. No html or body tags requiredd \<style\> .rectangle { position: relative; width: 1200px; height: 600px; background-color: lightgray; border: 1px solid #000; } .dot { position: absolute; width: 10px; height: 10px; background-color…

> [@Dashboard Template script with msg.payload](https://discourse.nodered.org/t/dashboard-template-script-with-msg-payload/9983/3):
>
> This has some worked examples:

---

_[View the full topic](https://discourse.nodered.org/t/passing-msg-payload-into-template-node-script/92788)._
