I have a custom button that run a lightning component where I want it to be visible from a record only for certain User based on their role.

Any idea How to adjust this permission set. I know that we can add a filter through set component visibility for the total component but not for a specific button.

any idea ??


Unfortunately you don't have a clean way of doing this unless you code. Below are couple of options you have.

  1. Override the highlight panel with custom component to implement the behavior
  2. If the button is on related list, remove the related lists component and add individual related list standard components and override the the one where you have the button with a custom related list component.
  3. Dirty which I wouldn't recommend but you can throw an error message on the quick action when someone clicks the button that doesn't have the permission.

Honestly none of the above options really intuitive but gets the job done and also comes with lot of maintenance on your part

|improve this answer|||||

You cannot show/hide a button on a page using Role.

However, if you are targeting a particular role, then one approach is to group all Users on that role in to a specific profile.

The approach will be to assign such Users to a specific profile, create a page layout where you don't have the button and then assign that page layout to the profile.

If you cannot create another profile or page layout, then you can within your Lightning Component, verify if the User is of XYZ role, then display them a message which will suggest that they don't have necessary permission etc.

|improve this answer|||||

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.