# Creating a new node: how do I access the attributes?

**URL:** https://discourse.nodered.org/t/creating-a-new-node-how-do-i-access-the-attributes/29896
**Category:** General
**Created:** [11 July 2020 12:39 UTC](https://discourse.nodered.org/t/creating-a-new-node-how-do-i-access-the-attributes/29896 "2020-07-11T12:39:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vp2021](https://avatars.discourse-cdn.com/v4/letter/v/5fc32e/32.png) [@vp2021](https://discourse.nodered.org/u/vp2021)
#### Post date: [11 July 2020 12:39 UTC](https://discourse.nodered.org/t/creating-a-new-node-how-do-i-access-the-attributes/29896/1 "2020-07-11T12:39:23Z")

</div>

Hello,

I'm starting in the creation of nodes for Node-RED. I'd like to create a "simple" node that will take several parameters in its configuration window, and return a concatenation of these parameters...

I was able to create the different HTML fields. My problem is the following: in the javascript file, I can only retrieve the "name" attribute. I also have a "topic" attribute with a corresponding HTML input field, but I can't retrieve the value of this field in my javascript code.

Why does it work with the "name" field by doing  
#var msg = {payload:node.name}

but it doesn't work by going:  
#var msg = {payload:node.topic}

My HTML file with the 2 input name and topic :

 ![2020-07-11_142745](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/8/b8c83a66fc2899c5301ffbd747af6c56b6d5bb38.jpeg)

My javascript file where I can get the "name" attribute but not the "topic" attribute :  
(if I replace node.name =\> node.topic : the output show : " " )

 ![2020-07-11_142940](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/c/fce87566852359bab6423635038134bf2081aaeb.jpeg)

I hope my question is clear enough. Thank you in advance for your help.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [11 July 2020 13:26 UTC](https://discourse.nodered.org/t/creating-a-new-node-how-do-i-access-the-attributes/29896/2 "2020-07-11T13:26:52Z")

</div>

The confguration data is in the `config` variable not `this`. Typically, you assign the fields to `this`.

I try to keep best practices documented in my jktest node and you can see how to assign the config fields to the `node`/`this` object here:

> <https://github.com/TotallyInformation/node-red-contrib-jktesting/blob/master/jktest/jktest.js#L88-L89>

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [25 July 2020 13:26 UTC](https://discourse.nodered.org/t/creating-a-new-node-how-do-i-access-the-attributes/29896/3 "2020-07-25T13:26:59Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
