How to create a javascript object using change node and flow variable

I know I can do this in a function node, but want to do it in a change node but I can't figure out how. I want to dynamically change the icon for a button based on a flow contect variable.

I use an inject to store an icon type like 'mi-clear' into flow.symbol.
In a change node I set msg.symbol to flow.symbol
Now I want to end up with msg.ui_control being {"icon":"mi-clear"} and I can't figure out how to do it.

Any hints or suggestions?

Make flow.symbol an array of values like:

{"icon":"mi-yet another"}

And do a lookup based on the input?

1 Like

How about a template node with below config ?



Use the JSONata expression: { "icon": $.symbol }

Thanks Nick, one of these days I'll understand jsonata ("Yeah right!" my brain says)

1 Like

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