Pages

Monday 2 September 2019

Control the Lightning Component visibility using Permission Set / Custom Permission

At Dreamforce'18, Salesforce had announced lightning pages. This adds even more custom pages by hiding and displaying fields/components based on the criteria. It means that you could potentially have a one-page layout with all the differences being controlled by component visibility criteria. No more tons of different page layouts by profile!

With Lightning Component Visibility, we can decide if the component will display on the page for the user based on some set of criteria. A common practice is based on the user’s profile or username.

The example we have here is pretty simple.

The custom lightning component should only to be visible to a particular set of users within the profile.


1. Create new Custom Permission if it does not exist. Setup -> Custom Permission -> New.




 2. Go to the Lightning record page, set component visibility -> Filters. Choose Permissions -> Custom Permission and search for custom permission which was created in step 1. 












3. Create a new permission set and assign the custom permission to it.
4. Final Step, Assign the Permission set to the users.

Result:






1 comment :

  1. Hi - Have you tried this with a flow component? Also for a sys admin? I have users in multiple profiles/roles which need access to a given flow component (as back ups). I can get this very cool idea you've shared.. to work for a report chart for a non sys admin user..but not for my user for the report chart and for no users for a flow component. Have you gotten it to work in those scenarios.

    ReplyDelete