How to display button on VisualForce page only if user has Delete permission?

This may be useful for both usual Salesforce Developers and ISVs.

There are several ways to achieve the functionality described in the header. I would mentioned only the simpliest one:

Assume you have custom object CustomObject__c and you need some button Delete to be displayed only if user has Delete permission on  custom object CustomObject__c. Then you can use following snippet of code:

<apex:commandButton value="Delete" rendered="{!$ObjectType. CustomObject__c.deletable}"/>

Enjoy 🙂

This entry was posted in salesforce, Uncategorized, visualforce and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s