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
AkoAko 

Hiding a Custom Button based on Profiles Security

I have created a custom button which I use on the Contact Detail page. I am wondering if there is any way to show or hide the button based on the users security settings (profile)? Is this possible? I only want certain profile types to be able to use the button.
I couldn't find any security settings based around Custom Buttons.
Thanks for any help!
-Jeff
JohanLiljegrenJohanLiljegren
I don't think you can. A button belongs to a page layout and that layout is assigned to certain profile(s). So, if any of the profiles who are assigned that page layout shouldn't see the button you need to create another page layout. Sorry... :(

What you could do is to create a new field (yes, field!) on the Contact object.
The field should be a Formula(Text) field with just one function in it, a call to HYPERLINK().

Here's the trick: You add it to the page layout, but only allow certain profiles to see the field by using Field Level Security.
AkoAko
That's a good idea, thanks for the tip! I'll try that method out.
HerreromHerrerom

Dear Johan,

I liked your trick. Do you have another trick for buttons that belongs to view (because for example, I have created a button to mass approve cases, so the buttons are available in the cases list views but I would like them to be available only for some users).

Thank you.

Michael

Elly-BIGElly-BIG
I would love to have that ability also.  Right now I check if the user is allowed to use the button adn pop up a message if they aren't - not nice.  IT=t would be so much better to be able to hide the button from the view.  Or at least only assign buttons to certain views since I can control who sees the view. 
 
Has anyone done this?
 
Thanks,
Elly