# How to pass payload data from user "form" to function

**URL:** <https://discourse.nodered.org/t/how-to-pass-payload-data-from-user-form-to-function/30106>\
**Category:** General\
**Created:** [15 July 2020 07:34 UTC](https://discourse.nodered.org/t/how-to-pass-payload-data-from-user-form-to-function/30106 "2020-07-15T07:34:36Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![zazas321](https://avatars.discourse-cdn.com/v4/letter/z/59ef9b/32.png) [@zazas321](https://discourse.nodered.org/u/zazas321)\
**Post date:** [15 July 2020 10:38 UTC](https://discourse.nodered.org/t/how-to-pass-payload-data-from-user-form-to-function/30106/16 "2020-07-15T10:38:45Z")

</div>

When using the function node:

```auto
{"payload":{"Item":"item_test_function","Serial":12345},"socketid":"fo8kJFtN6HuwBUOHAAAE","_msgid":"33b945ef.2d52ba","topic":"INSERT INTO pack_to_light (Device,Item,Serial)VALUES('device1','${item}',${serial})"}

```

when using the template node:

```auto
{"payload":{"Item":"item_test_template","Serial":12345},"socketid":"fo8kJFtN6HuwBUOHAAAE","_msgid":"20d8bcb0.82c844","topic":"INSERT INTO pack_to_light (Device,Item,Serial) VALUES ('Device1', 'item_test_template',12345 );"}

```

Note that I have changed my database and function slightly:

function node

```auto

m=msg.payload
item = m.Item
serial = m.Serial

msg.topic="INSERT INTO pack_to_light (Device,Item,Serial)VALUES('device1','${item}',${serial})";
return msg;

```

---

_[View the full topic](https://discourse.nodered.org/t/how-to-pass-payload-data-from-user-form-to-function/30106)._
