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
ramanapatlammagariramanapatlammagari 

Hiding Button based on Profiles in Visual force page.

 

Hi All,

  

      How can I Control Visibility  of a button  present in  visual force page based on user's profile.

 

                     For e.g    The Button " save" should be Visible to System Admin profile and should'nt be visible to any other logged user profile.

                        

 

Thanks,

Ramana

Best Answer chosen by Admin (Salesforce Developers) 
SteveBowerSteveBower

<apex:commandButton value="Something Only For SysAdmins" action="{!doSomething}" immediate="true" rendered="{!$Profile.Name == 'System Administrator'}"/>

All Answers

SteveBowerSteveBower

<apex:commandButton value="Something Only For SysAdmins" action="{!doSomething}" immediate="true" rendered="{!$Profile.Name == 'System Administrator'}"/>

This was selected as the best answer
Ilan Levi-MazloumIlan Levi-Mazloum
SteveBower, it doesn't work if you use multi language system, since the profile name changes with the language.