val SocketItem = ScriptServiceUtil.getItemRegistry.getItem(transform("MAP", "broadlink.map", receivedCommand.toString))
But item not in registry i get
2020-01-13 21:24:43.982 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Change Item State from real Remote Controller': Item '' could not be found in the item registry
transformation returns result. Again the same code i get sometimes error is there is no transformation
2020-01-13 21:24:43.978 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'ID-0171f400--SWITCH-2--CMD-OFF' with the file 'broadlink.map' : Target value not found in map for 'ID-0171f400--SWITCH-2--CMD-OFF'
I don’t know of a way in Rules DSL. You might be able to put the call to getItemRegistry into a try/catch and catch the exception when it doesn’t exist.
I Scripted Automation it’s pretty easy and you have lots of ways. I’d probably use (Python)
if "ItemName" in items:
It there is no entry in the map file for that value you will get an error from the transformation. Again, you might be able to put the transform into a try/catch.
But one wonders why you are using the map. Perhaps there is a way to generate the Item name from the message directly (e.g. strip off the stuff at the end?).