function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SupervedisSupervedis 

Hiding a custom button for a specific user

How do you hide a custom button for a specific user since we cannot use the clone page layout concept?

Best Answer chosen by Admin (Salesforce Developers) 
flewellsflewells
I do not recommend this as best practice, but at first glance it seems more favorable than creating a VF page -- that is, create a new profile for your user, create a new page layout without the custom button and then assign your new page layout to the new profile.

All Answers

Jake GmerekJake Gmerek

You would have to write a custom VF page to do this because custom buttons have no inherent security features built in.  Why could you not clone a page layout?

flewellsflewells
I do not recommend this as best practice, but at first glance it seems more favorable than creating a VF page -- that is, create a new profile for your user, create a new page layout without the custom button and then assign your new page layout to the new profile.
This was selected as the best answer
SupervedisSupervedis

Thanks flewells but what  are the steps  to creating a profile and cloning a page. thanks in advance.

flewellsflewells
Easiest way to create a new profile is to clone an existing profile. Step by step instructions are provided within Help & Training. Search on "clone profile" within Help to find the help topic titled "Cloning Profiles". Once you save your new profile, remember to update the User's record with this new profile. Similarly, the easiest way to create a new page layout is clone an existing one. Search on "clone page layout" in Help & Training to find the help topic titled "Creating Page Layouts". Remove the button you want to hide from this new layout. Lastly you need to assign this new page layout to your new profile (and therefore this one user who has this profile). See help topic "Assigning Page Layouts from a Customize Page Layout or Record Type Page". Definitely not ideal to create a new profile for just one user, but it works...