Obtaining sObject Describe Results Using Tokens

To access the describe result for an sObject, use one of the following methods:

  • Call the getDescribe method on an sObject token.
  • Use the Schema sObjectType static variable with the name of the sObject. For example, Schema.sObjectType.Lead.
Schema.DescribeSObjectResult is the data type for an sObject describe result.
The following example uses the getDescribe method on an sObject token:
Schema.DescribeSObjectResult dsr = Account.sObjectType.getDescribe();
The following example uses the Schema sObjectType static member variable:

Schema.DescribeSObjectResult dsr = Schema.SObjectType.Account;

Published by Sandeep Kumar

He is a Salesforce Certified Application Architect having 11+ years of experience in Salesforce.

Leave a Reply