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
Abhirams470Abhirams470 

how to hide image depends upon Profiles

Iam trying to hide flag iamge for some profiles and visible to some profiles in visualforce page

 

 

 

i really appreciate if any one can help me

 

Thanks,

Abhi

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Rahul SharmaRahul Sharma

Another option would be to define a controller or extension for the page.
And create a Boolean property and in constructor check if current user's profile falls in which section(hide or show image), based on the condition make Boolean true or false.
Then use that Boolean flag in visualforce page to hide show the image.

 

Or another simpler option would be as suggested above

 

<apex:image id="theImage" value="/img/myimage.gif" rendered="{!$(Profile.Name == 'User 1' || Profile.Name == 'User 2')}"/>

 For multiple users, you can add names of user in rendered property.

All Answers

ManjunathManjunath

Hi,

 

Try using rendered attribute.

Ex: <apex:variable value="{!$User.ProfileId}" var="pfid"/>
        <apex:tabPanel rendered="{!if(pfid=='00e90000000v******',false,true)}">

Make sure your id your comparing is of  18 digit because {!$User.ProfileId} gives 18 digit id.

 

Regards,

Rahul SharmaRahul Sharma

Another option would be to define a controller or extension for the page.
And create a Boolean property and in constructor check if current user's profile falls in which section(hide or show image), based on the condition make Boolean true or false.
Then use that Boolean flag in visualforce page to hide show the image.

 

Or another simpler option would be as suggested above

 

<apex:image id="theImage" value="/img/myimage.gif" rendered="{!$(Profile.Name == 'User 1' || Profile.Name == 'User 2')}"/>

 For multiple users, you can add names of user in rendered property.

This was selected as the best answer
Abhirams470Abhirams470

Thanks, i got resolved the problem.It's working good

 

 

Thanks,

Abhi