I want to display HTML button to System admin and Super User. I have written the below code:

<apex:outputPanel rendered="{!isEditAllowed}" layout="none">
 <button type="button" onclick="uncheckCheckboxButton();" class="btn btn-primary btn-xs addCheckButton"  hidden="{!IF($Profile.Name =='System Administrator'||$Profile.Name =='Super User', false, true)}">Uncheck</button>

but it does not hide/show the button based on profile. can someone tell what I am missing here.

  • check this boolean variable: rendered="{!isEditAllowed}". Or simple remove rendered="{!isEditAllowed}" and try. It will work Feb 17, 2017 at 15:29

2 Answers 2


You can simply use all the conditions in the single rendered attribute.

I thinkisEditAllowed value is not properly returned at your page. Thats why it is not getting rendered properly.

This code is working correctly at my DE.

<apex:outputPanel rendered="{!isEditAllowed && ($Profile.Name ='System Administrator' 
                   || $Profile.Name ='Super User')}" layout="none">
 <button type="button" onclick="uncheckCheckboxButton();" 
              class="btn btn-primary btn-xs addCheckButton"> Uncheck

You are having two rendered conditions one for output panel and again you are adding rendered condition for button, render out-panel only when user profile is system admin or other that will help you display button based on rendering condition you have added, also check what isEditAllowed is returning because this the primary condition for rendering the output-panel.

<apex:outputPanel rendered="{!userProfileName == $Label.Profile_SystemAdmin}"    layout="none">
    Your Button Code

At Controller Side get set userProfileName Like follow which will return you current loggedin user profile.

//Variable to return current logged in User Profile
public String userProfileName {                                     
        get {
            return [
                    select Profile.Name
                    from User
                    where Id = :Userinfo.getUserId()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.