Use env or global variables in expression in change node

grawsom
Wed, 27 Aug 2025 12:43:49 +0000
Dashboard

Found an old post by @E1cid where DB1 button was configured to change info on every press (toggle).

Toggle Status Buttons Dashboard

something like this [{"id":"839b0fab.0972e8","type":"inject","z":"5a245aa1.510164","name":"Setup ","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"","topic":"","payload":"","payloadType":"str","x":340,"y":3540,"wires":[["557c0081.636f88"]]},{"id":"557c0081.636f88","type":"change","z":"5a245aa1.510164","name":"","rules":[{"t":"set","p":"X","pt":"flow","to":"$exists($flowContext(\"X\")) ? \t$flowContext(\"X\") : 0","tot":"jsonata"},{"t":"set",…

I have changed that to DB2 and is working fine, my question now is.

In DB2 you use msg.ui_update.label to set the name.

Is it possible to use an global variable or env. varibable, so you can configure the name else where.

I my ex. I want to get the name "MYNAME" replaced with an variable or env.

[{"id":"67f659a2f96d63da","type":"ui-button","z":"69594495cf1ea8a1","group":"1579a21dbba7922e","name":"RBE Button y","label":"","order":3,"width":3,"height":3,"emulateClick":false,"tooltip":"","color":"{{feedback.fontClr}}","bgcolor":"{{feedback.colour}}","className":"","icon":"","iconPosition":"left","payload":"Y","payloadType":"flow","topic":"","topicType":"str","buttonColor":"","textColor":"","iconColor":"","enableClick":true,"enablePointerdown":false,"pointerdownPayload":"","pointerdownPayloadType":"str","enablePointerup":false,"pointerupPayload":"","pointerupPayloadType":"str","x":1200,"y":500,"wires":[["af2578664c101792"]]},{"id":"af2578664c101792","type":"change","z":"69594495cf1ea8a1","name":"","rules":[{"t":"set","p":"Y","pt":"flow","to":"payload = 1 ? 0 : 1","tot":"jsonata"},{"t":"set","p":"ui_update","pt":"msg","to":"payload = 1 ?\t{\"buttonColor\": \"green\",\t\"label\": \"MYNAME HERE\",\t\"textColor\": \"white\"} \t:\t{\"buttonColor\": \"red\",\t\"label\": \"MYNAME GONE\",\t\"textColor\": \"black\"}\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1210,"y":550,"wires":[["67f659a2f96d63da"]]},{"id":"1579a21dbba7922e","type":"ui-group","name":"Button Test","page":"ab2cbf2599cace69","width":7,"height":"5","order":1,"showTitle":false,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"ab2cbf2599cace69","type":"ui-page","name":"Buttons","ui":"a8dc4de17ff7d144","path":"/buttons","icon":"navigation","layout":"grid","theme":"970cbcc1aaf503af","breakpoints":[{"name":"Default","px":"0","cols":"3"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":3,"className":"","visible":"true","disabled":"false"},{"id":"a8dc4de17ff7d144","type":"ui-base","name":"UI Name","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-control","ui-notification"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":false,"notificationDisplayTime":5,"showDisconnectNotification":false},{"id":"970cbcc1aaf503af","type":"ui-theme","name":"Theme Name","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"}}]

12 posts - 5 participants