Openhab 4.0 - js rules

sth is wrong jss scripting - can’t get medatavalue it was working on <4 version
[ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script ‘/etc/openhab/automation/js/rulesCreator.js’: org.graalvm.polyglot.PolyglotException: TypeError: (intermediate value).getItem(…).getMetadataValue is not a function

What about posting your code instead of just posting only the error message. Provide a little bit of context.
You may have noted from the documentation that the item object doesn’t have a function getMetadataValue(), only getMetadata().

Sure,
i am using /automation/js to play with my rules. I often use metadata value in my rules. It was working in 3.x.

if ( items.getItem(gRoom${i}_termostat).getMetadataValue(Type) == “grzejnik”)
{}

now it seems to not work :frowning:

ok i found a bug in the code sorry

For the benefit of future readers, the API to access and manipulate Item metadata changed in the openhab-js library around 4.1 if I recall correctly. Previously you could not access and set the configuration, just the value.