Skip to main content

Schema Class

The methods of Schema Class should be static.

Schema.getGlobalDescribe() returns a Map, i.e, key and value pair.

Schema.Describe calls describes metadata for given sObject/array of sObject. It returns information about standard and custom apps.

Object-level and Field-level permissions are enforced in code by calling sObject describe result methods.

Schema.DescribeFieldResult checks the current user's create, edit, delete permissions through these:

.isAccessible 
.isCreatable
.isUpdateable
(For read, write and update permissions)

How to determine if the field level permission is checked or object level permission?

if(Schema.sObjectType.Contact.fields.Email.isCreatable())
this checks the field level create permission

if(Schema.sObjectType.Contact.isDeletable())
This checks the object level permission.

Comments