How to fetch session info or session custom property in the script library or in tag scripting

I want to fetch session user name in script library.

This looks like a Perspective question. (Always add the tag to make it clear.)

Try reading the username key in
https://docs.inductiveautomation.com/display/DOC81/system.perspective.getSessionInfo

2 Likes

The project script library doesn't have a scope of its own. Project library functions run in the scope of the ultimate caller of the function. Call from a Perspective scope, and Perspective's automatic variables will be there. Call from any other scope (like tag events or gateway timers), and those automatic variables won't be there. It is best to write project library functions to take arguments passed from the caller to explicitly transfer access.

2 Likes