Custom Permissions in Lighting Record Page- User Visibility Restriction

Screen Shot 2018-12-08 at 1.33.10 PM.png

Control the component visibility on a lightning page, I would like to show a component on a lightning record page only when the user is assigned a specific permission set. We can use custom permissions to achieve this.

 

 

What is custom permissions?

Custom permission let you define your own permissions for use within your salesforce environment. You could then assign these permissions to either a permission set or a profile. More details here.

The Solution

  • Setup -> Custom Permissions . Create new and name it ‘ShowAccountHighlights’
  • Create a new permission set or use an existing one. On the permission set overview page, click on Custom Permissions link and add the new custom permission you created.
  • On the user object create a new field of type formula and checkbox as formula return type.
    • For example: Field Label:ShowAccountHightlights
      • Data Type : Formula
      • Formula: $Permission.ShowAccountHightlights
  • Edit the lightning record page and set the component visibilty using the new field you created.

     

  • Now, just assign the permission set to a user to make this component visible for them.
Advertisements