Show Hide component based on the assigned permission set

  • 2
  • Question
  • Updated 2 weeks ago
  • Answered
I have a skuid page with multiple tabs and I want to render and display tabs based on the permission set assigned for the current user,
Is there a way of doing this? or any alternatives?

Thanks In advance
Photo of Hasantha Liyanage

Hasantha Liyanage

  • 1,446 Points 1k badge 2x thumb

Posted 3 years ago

  • 2
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Two alternatives:

(a) Render based on the user's Profile Name or Id

(b) Render based on whether a User's Profile or Permission Set gives them access to a Custom Permission. Create Custom Permissions in Salesforce Setup, e.g. "Can View Tab A", "Can View Tab B", etc. or "Can View Activities Tabs", "Can View Case Tabs", etc. Then, create 1 or more Formula Fields on the User object in Salesforce that describe whether the User has these Custom Permissions. You could use a Boolean field for each Permission, e.g. "User_Can_View_Activities_Tabs" whose formula is IF($Permission.User_Can_View_Activities_Tabs,true,false) , or you could use a single String field that dumps out the names of all the Permissions that the user does have access to, e.g. 

IF($Permission.Can_View_Activities_Tabs,'Can View Activities Tabs','')
 & "," IF($Permission.Can_View_Contacts_Tabs,'Can View Contacts Tabs','')
 & "," IF($Permission.Can_View_Notes_Tabs,'Can View Notes Tabs','')



Then you would add a "RunningUser" Model to your Skuid Page(s) that requests this/these Formula Fields on the User object for the running user, and then you can do Conditional Rendering based on the values in these Formula Fields in the row in this Model.



Photo of Hasantha Liyanage

Hasantha Liyanage

  • 1,446 Points 1k badge 2x thumb
Hi @Zach,
Thank you for the reply,

To access profile name or permission set we need "View Setup and Configuration" enabled on profile or permission set so then only we can access the profile model to check for the profile name. We do not want users to see the setup and configuration stuff.

It seems the only way of going forward is the hard coded profile ID.

Thanks again and this replay helped me a lot.
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Hi Hasantha, you are correct about Permission Sets, the PermissionSetAssignment object is only visible to users who have the View Setup and Configuration permission.

However regarding Profile Name, as of the Skuid Banzai release, Profile Name is available as a standard Conditional Rendering "Running User Attribute" property, without having to use a separate Model, and this works for any User, they don't need to have View Setup and Configuration for this to work.

Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
The use of Custom Permissions and a custom User field is a great way to get around Customer Community Users' lack of access to Permission Set and Permission Set Assignment objects. Still useful post three years later!
(Edited)