Make a button on a layout be visible only to a specific group of users

  • If I want a specific field to be visible only to a specific user or group of users on a layout, I set up field-level security for this field. I want to be able to do the same for my custom button added to a layout. I want a specific button be visible only by a specific group of users.

    Is there a way to set a 'button-level' security in order to achieve this? It would be perfect if I could use a permission set.

    UPDATE: I know that there were some questions on how to hide a specific button depending on a specific value of an object's field (I already use this solution is another situation), but I want a different thing. I want to be able to specify a permission to see a specific button for a specific group of users.

    I saw those questions, but mine is a little bit different. I have updated the question.

  • sfdcfox

    sfdcfox Correct answer

    7 years ago

    Buttons don't have a corresponding "button-level" security. There are at least three ways to get around this:

    1. Write a Visualforce page that overrides your default layout. Have that Visualforce page determine if the button should be rendered.

    2. Use page layouts and assign different layouts by profile. Unfortunately, you can't use permission sets this way.

    3. Create a formula field that makes a link to take them to somewhere, similar to the button. Use permission sets to control access to the link via the field level security. Of course, JavaScript is not going to help you here.

    On the other hand, if the button links to a Visualforce page, you could just restrict access to the page itself; they'll still see the button, but get an error when they click on it.

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM