1

I am attempting to show/hide a component on my Lightning Page using a visibilityFilter attribute based on $User.UserRole.DeveloperName

I have carefully compared the running User's Role DeveloperName to the DeveloperName (using _) however when I set the following:

<visibilityRule>
   <criteria>
     <leftValue>{!$User.UserRole.DeveloperName}</leftValue>
     <operator>EQUAL</operator>
     <rightValue>EEE_Manager</rightValue>
   </criteria>
</visibilityRule>

Visibility based on User Role

And Login as the user, the component is not displayed. If I update the criteria to Not Equals or NE operator, the component is displayed?

Note If I remove the visibility filter complete, the component is displayed- so I don't believe it's an access issue.

The user's profile DOES NOT have View all Data, or View Role and Role Hierarchy Permissions- if I enable View Role and Role Hierarchy Permissions the component appears?

So View Role and Role Hierarchy permission is determined for the user to see the name of their own role? 😕🤷‍♂️

1 Answer 1

2

if I enable View Role and Role Hierarchy Permissions the component appears?

Yes, and I've tested this in my dev org.

So View Role and Role Hierarchy permission is determined for the user to see the name of their own role?

Yes, View Roles and Role Hierarchy permission is required for a user to see their own role name. Note that this permission would normally open up access to view all the roles and role hierarchy. However, if a user has this permission & not the view setup and configuration permission, then this user

  • can see the role name (as a hyperlink) in their settings page (under My Personal Information > Advanced User Details/ see screenshot below).
  • cannot navigate to the role details page by clicking on the hyperlink.

enter image description here

If you revoke the View Roles & Role Hierarchy permission, then the role will not be displayed in the advanced user details page (unlike shown in the screen shot above). Instead, the role field will display blank.

1
  • Great - thanks for the comprehensive answer! Aug 19, 2020 at 22:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .