Salesforce: Restrict Button Execution

If you have a button in a page layout and you only want Administrator to see it, how can you do that?


Option #1: Page Layout

Use different page layout for a different profile. Show the button only in Administrator page layout


Option #2: Visualforce

You can create a validation at your controller and check the user profile before executing any logic


Option #3: Javascript

You can write Javascript in a button that gives you the following functionality.



This would be a quick workaround if you are using Professional edition and do not want to develop any Apex code. However, this validation is a Javascript code from a client browser, if the user has the link or change their HTML client behaviour, they will be able to bypass this.

Get in touch today to see how we can help you.