1

I have a requirement where a lightning component should be displayed to 5 specific profiles and for other profiles it should not be visible.

How i can achieve this in lightning? Please guide me i am new to lightning.

Thanks!!

3 Answers 3

6

This can be done with no coding. Go to Lightning App Builder via 'Edit Page' option, select your component and in the properties panel on the right, specify the condition under 'Set Component Visibility'. See below screenshot for clarity:

enter image description here

Also, FYI: Winter 19 release extends this feature beyond Record and User fields by allowing Custom and Standard User Permissions as well (not Permission Sets).

4
  • Thanks for the reply kal,do i need to give the profile names separated by comma or semicolon in the value field ?
    – user46777
    Commented Sep 12, 2018 at 7:01
  • I tried with the above solution that you provided by editing the page and providing the value as System Administrator but still this component is showing to other profiles also.Please guide.
    – user46777
    Commented Sep 12, 2018 at 7:31
  • It will not work for tabs i read...As i have various tabs in my page....the filter visibility is not working....how i can proceed with this further.
    – user46777
    Commented Sep 12, 2018 at 9:38
  • You could have up to 10 filters and set a combination of AND/OR conditions around them as well. And you are right, visibility filters aren’t supported for individual tabs inside the Tabs out-of-the-box standard component, but can be set for components housed within those tabs. If you want to show/hide the tabs along with the components, I am afraid you must resort to custom component via lightning:tabset and lightning:tab. Here is more info about 'Set Component Visibility': help.salesforce.com/… Commented Sep 13, 2018 at 12:56
3

There are 2 ways

  1. Using Lightning Pages Activation: Whenever you create a lightnining pages you can make it available to certain profile and apps. This will make sure that the only certian profiles can see the page which has that components embedded. enter image description here

  2. Using Lightning component Visibility: Add that lightning component into all pages. Then in the visibility session of lightning component add visible only if profile is some certain profile.

enter image description here

0

We can use the dynamic forms and then can set the component visibility of our LWC component to some specific profiles.

https://ibb.co/FY0XDpk

enter image description here

2
  • 1
    Two other answers already point out "Component Visibility". Could you elaborate a little bit why your answer is nevertheless valuable? And why adding a link to a screenshot on a third party site, when the same screenshot is already displayed here?! Commented Sep 14 at 19:22
  • I found one more way, as there can be a scenario where we have to add visibility for a larger number of users, we can add any unique permission on the profile of the users for which we have to show the component and use that permission here in the component visibility section. I shared the link, if in case the image does not get load to the other users! No other reasons! Commented Sep 15 at 20:17

You must log in to answer this question.

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