hasRole expression in Vision Client Tags not working

Good morning,

I'm trying to bind the "Show Ack Button" property of the Alarm Status Table to a Vision Client Tags, but it is not working as expected.

I've created a boolean expression tag in the Vision Client Tags called Role. The code is very simple:

! hasRole("Guest")

I expect that if the log in role is different from "Guest" my tag is True and viceversa, but it isn't working at all, it never change the status.

Actually I'm binding the "Show Ack Button" property of the Alarm Status Table directly with the same expression

! hasRole("Guest")

and it works perfectly. It looks like if I bind it with a Vision Client Tags it's not working.

Where is the error?
The version of Ignition is 8.1.23

I've solved in this way always in the expression:

{[System]Client/User/RolesString} != "Guest"

I don't know why hasRole is not working.

Hm. hasRole is working the way I would expect in a client tag for me. Were you testing in the designer, or a full client instance?

1 Like

I tested in both way, designer and full client instance. It looks very strange because if I use hasRole directly in the Alarm Status Table binding it works, but if I use in the client tag it has no effect.

I have the same issue, I have a Vision Client Tag "EnableSecurity" with an expression:
hasRole("Administrator") || hasRole("Engineer") || hasRole("Supervisor")

On a button .enable is tag [client]EnableSecurity
The button is enabled in the Designer but not in the Client instance (version 8.1.25)

Edit: This works correctly if referencing {[System]Client/User/RolesString} as Aiasa21 mentioned:
if((indexOf({[System]Client/User/RolesString}, "Administrator") >= 0) ||
(indexOf({[System]Client/User/RolesString}, "Engineer") >= 0) ||
(indexOf({[System]Client/User/RolesString}, "Supervisor") >= 0),true,false)