# Value from Payload is empty

**URL:** https://discourse.nodered.org/t/value-from-payload-is-empty/5965
**Category:** General
**Created:** [19 December 2018 15:17 UTC](https://discourse.nodered.org/t/value-from-payload-is-empty/5965 "2018-12-19T15:17:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Lee](https://avatars.discourse-cdn.com/v4/letter/l/bc8723/32.png) [@Lee](https://discourse.nodered.org/u/Lee)
#### Post date: [19 December 2018 15:17 UTC](https://discourse.nodered.org/t/value-from-payload-is-empty/5965/1 "2018-12-19T15:17:23Z")

</div>

I am new to red node and trying to set up a flow to insert messages in a MS SQL database.

I am having difficulty passing the values from the payload to the query. I can successfully insert into my table as long as a don't have any variables and the values are hard coded. Unfortunately when I pass a value to the query from the payload, my string is empty.

I am using a template node set to plain text to prepare the query for the sql node.

**Inject Node:**  
Payload is set to JSON  
{  
"service": "myServiceName"  
}

**Template Node:**  
Insert into ActivityLog (ServiceName, MessageType, MessageText)  
Values('{{msg.payload.service}}', 'sdfsd', 'sdfs');

**Result in Debugging** (empty string where my value should be):  
Insert into ActivityLog (ServiceName, MessageType, MessageText) Values('', 'sdfsd', 'sdfs');

Thanks is advance for any guidance you can offer!

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [19 December 2018 15:22 UTC](https://discourse.nodered.org/t/value-from-payload-is-empty/5965/2 "2018-12-19T15:22:27Z")

</div>

If you look at a "new" template node after you have dragged it onto the canvas you will see

`This is the payload: {{payload}} !`

So the chances are your `Values('{{msg.payload.service}}', 'sdfsd', 'sdfs');`  
should be `Values('{{payload.service}}', 'sdfsd', 'sdfs');`

---

<div class="post-metadata">

### Author: ![Lee](https://avatars.discourse-cdn.com/v4/letter/l/bc8723/32.png) [@Lee](https://discourse.nodered.org/u/Lee)
#### Post date: [19 December 2018 15:24 UTC](https://discourse.nodered.org/t/value-from-payload-is-empty/5965/3 "2018-12-19T15:24:35Z")

</div>

Thank you @ukmoose! That was it. I replaced msg.payload.service with payload.service. Thanks for the quick response!
