[import] Notify User Method failing on logged on users not in a ViewX session
>>Message imported from previous forum - Category:ClearSCADA Software<< User: rlao, originally posted: 2019-03-07 23:47:19 Id:380 Hi all,
We have a simple script that grabs a list of logged on users and calls a NotifyUser method on all of them to send a common message. This is used as a broadcast alert to all logged on users when there is upcoming work on the live SCADA system.
The issue is that filtering for IsLoggedOn =TRUE on CDBUsers not only returns logged on ViewX users, but it also returns WebX users, service accounts and users logged on via tools such as QueryPad. The NotifyUser method is failing on those users and throwing up script errors, presumably as there is no interface to 'notify' those types of users.
My question is: Is there a way to distinguish logged on users based on how they are logged on, whether it be through ViewX, WebX, etc.
Reply User: hardin4019, posted: 2019-03-19 16:52:00 Something I finally might be able to help with!
Try adding a check to see what work station the user is logged in from. The same area where you fined Username.IsLoggedIn, there is a Username.CurrentNamedWkstns. ODBC connections, WebX users, etc, this will be blank. Only users with the ViewX client and named work stations show up.
Reply User: adamwoodland, posted: 2019-03-19 22:44:24 Hi 'rlao'!
The current workstations idea will only work if they are logging in from a named workstation, and that feature is really only for being able to assign alarms to a specific workstation so may not be configured on most systems. You also risk missing people who may be connected by the more dynamic workstations as keeping them configured with workstation names would be a pain.
I don't believe there is a fool-proof way to do it via the access you'll have.
How are you calling the NotifyUser? If its mimic scripting you could just wrap it around an "On Error Resume Next" and "On Error Goto 0" and that will just ignore those issues. If its logic you can also set that to ignore failed method calls in the logic program's properties.
Reply User: rlao, posted: 2019-03-29 06:24:09 Hi Hardin, unfortunately we do not use named workstations here so this property will turn up blank on ViewX users as well.
Hi Adam, we did end up using 'On Error Resume Next' exception handling to get around this which worked exactly as you described. It looks like that's pretty much the best way to go!