+ Start a Discussion
Robbi ConverseRobbi Converse 

Restrict detail page visibility based on user profile

I used the following to restrict visibility of the account detail page from non-owners:

<apex:page standardController="Account">
    <apex:detail rendered="{!$User.Id=Account.OwnerId}"/>
     
    <apex:pageblock title="Detail" rendered="{!$User.Id<>Account.OwnerId}">
        <apex:pageBlockSection collapsible="false" >
            <apex:outputField value="{!Account.Name}"/>
            <apex:outputfield value="{!Account.OwnerId}"/>
            <apex:outputfield value="{!Account.Active_Account__c}"/>
         </apex:pageBlockSection>
    </apex:pageblock>
 
</apex:page>

This worked, but also restricted the view of System Admins. I tried adding: <apex:detail rendered="{!$User.Profile=System Administrator}"> and many other versions, but the system does not recognize User.Profile as a field.

Help! What am I doing wrong and how can I make sure that System Admins are not affected by the visibility restriction?
kevin lamkevin lam
They syntax you need is:

$Profile.Name="System Administrator"