# Data from dropdownlist to set value in SNMP-set

**URL:** <https://discourse.nodered.org/t/data-from-dropdownlist-to-set-value-in-snmp-set/15823>\
**Category:** General\
**Created:** [23 September 2019 18:34 UTC](https://discourse.nodered.org/t/data-from-dropdownlist-to-set-value-in-snmp-set/15823 "2019-09-23T18:34:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kresten88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kresten88/32/13197_2.png) [@kresten88](https://discourse.nodered.org/u/kresten88)\
**Post date:** [23 September 2019 18:34 UTC](https://discourse.nodered.org/t/data-from-dropdownlist-to-set-value-in-snmp-set/15823/1 "2019-09-23T18:34:50Z")

</div>

In Node-red I would like to use e.g. the values from a dropdown list to send to an SNMP-set command. As I understand the snmp-set node uses msg.varbinds to get its data. But how do I refer to the value coming from the dropdown list in the msg.varbinds input, as it looks JSON to me

This is what I have in the Varbinds window. I thought I just had to refer to the msg.payload coming from the dropdown element, but that seems to be too easy.

```auto
[ {
            "oid" : "1.3.6.1.4.1.5835.3.1.3.1.38.1.1",
            "type" : "OctetString",
            "value" : msg.payload
        }
    ]

```

This is by the way the output from my dropdown list in the debug window.

9/23/2019, 8:13:04 PMnode: b4c9ef70.0f38d  
msg : Object  
object payload: "14300000000"  
socketid: "Xc-CPsZX-CouQVRAAAAA"  
\_msgid: "b77a7c3f.8645c"

---

<div class="post-metadata">

**Author:** ![kresten88](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kresten88/32/13197_2.png) [@kresten88](https://discourse.nodered.org/u/kresten88)\
**Post date:** [26 September 2019 10:52 UTC](https://discourse.nodered.org/t/data-from-dropdownlist-to-set-value-in-snmp-set/15823/2 "2019-09-26T10:52:27Z")

</div>

Problem solved:

After the dropdownlist node I needed a function with this:

```auto
var inputValue = msg.payload;
msg.varbinds = [
    {
        "host": "192.168.0.35",
        "version": "1",
        "oid": "1.3.6.1.4.1.5835.3.1.3.1.38.1.1",
        "type": "OctetString",
         "value": ""+msg.payload+""
    }
]
return msg;

```

After the function node comes the SNMP Set node where I had to leave the varbinds box empty.

---

<div class="post-metadata">

**Author:** ![heyhogan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/heyhogan/32/13897_2.png) [@heyhogan](https://discourse.nodered.org/u/heyhogan)\
**Post date:** [1 November 2019 17:43 UTC](https://discourse.nodered.org/t/data-from-dropdownlist-to-set-value-in-snmp-set/15823/3 "2019-11-01T17:43:43Z")

</div>

Thanks for posting this, it helped me understand and get this right. I still have an issue, using this code with a Syntax Error, Unexpected end of JSON input. Any ideas?
