0

I am pretty new to lightning so I wanted to know if there is a way to hide a lightning component based on certain conditions. I have a requirement where there are 4 components which need to be visible to users belonging to a particular profile and should not be accessible to others.

Thanks,

  • in what context, lightning experience, or lightning communities? – glls Jul 3 '18 at 14:36
4

You can conditionally show/hide components on the page by setting the component visibility. Select your component and in the properties panel you have the flexibility to show/hide based on a field in the record or user level attributes. See below for clarity:

enter image description here

enter image description here

1

You cannot give access to Lightning Bundle from profile.

But you can do is rerender based on the logged in user profile.

  • How, could you developp ? Thanks ! – Alexis MASSON Mar 4 at 10:27
0

You have 2 options:

  1. Create a custom lightning record home page for each profile and assign each page to each profile.

  2. Display/hide specific component, according to a field criteria on the current record.

Both scenarios are described well in this trail:

Build a Custom Record Page for Lightning Experience

The first scenario - under the Roll Out Your Custom Record Page to Your Lightning Experience Users section.

The second scenario - under the Make Your Record Page Dynamic section

0

You may find that your User>Profile>Name is "System Administrator". Check in Setup>Profiles.

You can also use filter logic for more complex conditions.

Two filters. Show if either is true.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.