hasRole() expression error and system tag path error

I have an error using hasRole() using single arg..

If i input all args it seems to be ok but thats manually entering username..

image

so i then try to get the user name from the system tags and it returns null? Even though it is reading within that username tag

I have tried creating a reference tag of the system tag out of curiosity to see if i could bring the username over into my default tag list but it then says path not found?

image

You are trying to use UI information in a global context. Tags don't have a user. They exist and execute whether anybody is connected or not, and regardless of how many are connected. You simply cannot use UI-specific information in an expression tag.

What are you really trying to do?

Im trying to change an image on the screen depending on the roles applied to the current user

also create a list of tags with each of the roles that had a boolean value. I may need it later on in the project

Use a root container custom property (boolean), with your ``hasRole()` expression. That runs in the client, and will be specific to that client. Use the resulting boolean in the components that need to change based on the role.

You can also use Vision Client Tags. These run in the client, too, and are client-specific.

1 Like