Resources available in (email) event handler scripts
-
Heya,
I am having some issues/confusion regarding the resources that are available in an (email) event handler.
I have a test script data source that retrieves the point hierarchy and list of data points and prints their length:
When I copy the same code to an event handler script, the lengths are 0 (or undefined):
Is the configuration and data point query not available in the event handler?
Aside: it's sometimes a challenge that the logging behaviour is not the same between a data source and event scripting. Unless logging is turned on in a data source script, log statements will not be displayed when validating the script. However, they will be displayed when validating an event handler script. This is kinda understandable considering there is no explicit switch for logging in the handler (which would be nice to have).
This there something I am missing?
Thanks
Ian -
Hi Ian,
I'd bet it has most to do with your scripting data source having permissions of 'superadmin' for everything, while the event handler script has no permissions.
Otherwise....
What version of Mango is this? The utilities should be available in any of the scripting contexts. Not all utilities are (such as the Excel Report post processing
script utility) and not all variables are (such as "evt" and "event" being defined in event scripts. The fact that you would get a zero length instead of a message about invoking a method on an undefined object suggests the DataPointQuery utility is available to use and that it would be something else.Aside: it's sometimes a challenge that the logging behaviour is not the same between a data source and event scripting. Unless logging is turned on in a data source script, log statements will not be displayed when validating the script. However, they will be displayed when validating an event handler script. This is kinda understandable considering there is no explicit switch for logging in the handler (which would be nice to have).
If you update to the 3.6 beta you'll see this is no longer the case with the new event handlers page.
-
Hi Phil,
Ahhh thanks! I figured it most have been something I missed.
Setting "Script data point read permission" to "superadmin" worked!
The /facepalm for me was that I was sure I had it working correctly before. I had created a script to create the handlers as they were going to be applied to a large number of data points (and event detectors). Likely I had missed this value in the script which has lead to some frustration. Whopps.
This is the current version of Mango (3.5x).
I haven't upgraded to the beta version yet as I usually shy away from these versions. ;) I also am trying to keep my version consistent with a few trials we have in progress until I can upgrade them all.
Thanks again,
Ian