Though, appSettings variable is accessible anywhere but I can’t access my appId from it. I get the error java.lang.NullPointerException: Cannot get property 'appId' on null object @line 24 (run) on accessing appSettings.appId.
However, I can also access the same inside initialize() function. Why can’t I access specific setting but can very well access appSettings variable as a whole?
tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
2
Have you set a value for appId in the SmartApp properties?
Thanks for the workaround but the workaround to copy it to the settings.* map in my initialize() method won’t benefit me as I want to acces it in preferences block. Also, I can get the value in any method, just not outside it. Is there any way to access the value in preferences block.
1 Like
tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
7
Ah… Preferences! … That’s the detail I was missing!
There are tremendous limitations as to what objects/variables are available in preferences{}. Preferences are actually metadata and not Groovy code / methods. This section is parsed by a preprocessor and/or rendering layer.
I frankly don’t think you can access appSettings within preferences{}. Along with a lot of other things you can’t do in preferences.
BTW: You’re also more likely to get a helpful answer here if you detail exactly what your goal is, rather than just the syntax you are attempting to use.