How to Check Object and Field Level Security Within a Visualforce Page?

Sample Code :

<!--Check object level access within a Visualforce page-->

<apex:page>

    {!$ObjectType.Contact.Accessible} 

</apex:page>


<!--Check an Object field level access within a Visualforce page-->

<apex:outputText value="{!contactName}" rendered="{!$ObjectType.Contact.fields.Name.Accessible}" />


<!--Check an Object field level Update access within a Visualforce page-->

<apex:inputText value="{!contactEmail}" rendered="{!$ObjectType.Contact.fields.Email.Updateable}" />


<!--Check an Object Delete access within a Visualforce page-->

<apex:commandButton action="{!CustomDelete}" rendered="{!$ObjectType.Contact.Deletable}" />


<!-- Check an Object field level Create access within a Visualforce page . stringToBecomeNewContactEmail is a generic string type-->

<apex:inputText value="{!stringToBecomeNewContactEmail}" rendered="{!$ObjectType.Contact.fields.Email.Createable}" />


Follow Us

Posted By : Sudeer Kamat Date :

view_module Related

label Labels

Comments 0