# Set Global Variable via button

**URL:** <https://discourse.nodered.org/t/set-global-variable-via-button/38327>\
**Category:** Dashboard\
**Created:** [31 December 2020 13:49 UTC](https://discourse.nodered.org/t/set-global-variable-via-button/38327 "2020-12-31T13:49:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lesterkelly](https://avatars.discourse-cdn.com/v4/letter/l/a698b9/32.png) [@lesterkelly](https://discourse.nodered.org/u/lesterkelly)\
**Post date:** [31 December 2020 13:49 UTC](https://discourse.nodered.org/t/set-global-variable-via-button/38327/1 "2020-12-31T13:49:55Z")

</div>

Hi,

I feel really stupid asking this but is it possible to set a global variable directly via a button press without having to use a function node or anything else. It looks like if I set the action field to global, all I have to do is type "set("ControlStatus", "on")" but this doesn't work. Am I missing something or why else would they have the drop down option of global if it's not possible.

Thanks

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [31 December 2020 14:00 UTC](https://discourse.nodered.org/t/set-global-variable-via-button/38327/2 "2020-12-31T14:00:53Z")

</div>

You can access/read a global value but not set one.

---

<div class="post-metadata">

**Author:** ![lesterkelly](https://avatars.discourse-cdn.com/v4/letter/l/a698b9/32.png) [@lesterkelly](https://discourse.nodered.org/u/lesterkelly)\
**Post date:** [31 December 2020 14:27 UTC](https://discourse.nodered.org/t/set-global-variable-via-button/38327/3 "2020-12-31T14:27:11Z")

</div>

Thank you very much. @E1cid

---

<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:** [14 January 2021 14:27 UTC](https://discourse.nodered.org/t/set-global-variable-via-button/38327/4 "2021-01-14T14:27:32Z")

</div>

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