getUser() function scope?


You may need an additional except clause:

except java.lang.Exception, e:
1 Like

It’s almost certainly failing because a gateway tag change script has no concept of a ‘default user source’, so attempting to use the empty string parameter is failing.

2 Likes

What value should I pass as the userSource?

Perhaps I should ask, where do I look to know what the userSource should be?

Looking at the documentation for getUser() . . .

https://docs.inductiveautomation.com/display/DOC81/system.user.getUser

in regards to userSource, it only says String userSource - The name of the user source to search for the user in . . .

OK I found it, in the Gateway. In my case it was ‘default’, passed as the userSource, this worked. Thanks for the info. .

I’m going to try your suggestion too. Thanks for mentioning that. I’ve been stumped several times in the past where scripts just terminate without triggering the error handlers. It’s as if nothing happened and nothing is brought to anyone’s attention until users notice odd behavior.

2 Likes