Newer Version Available

This content describes an older version of this product. View Latest

describeSObject()

Describes metadata (field list and object properties) for the specified object.

describeSObjects() supersedes describeSObject(). Use describeSObjects() instead of describeSObject().

Note

Syntax

Usage

Use describeSObject() to obtain metadata for a given object. You can first call describeGlobal() to retrieve a list of all objects for your organization, then iterate through the list and use describeSObject() to obtain metadata about individual objects.

Your client application must be logged in with sufficient access rights to retrieve metadata about your organization’s data. For more information, see Factors that Affect Data Access.

Sample Code—Java

This sample calls describeSObject() to perform describes on the Account sObject. It retrieves some properties of the sObject describe result, such as the sObject name, label, and fields. It then iterates through the fields and gets the field properties. For picklist fields, it gets the picklist values and for reference fields, it gets the referenced object names. The sample writes the retrieved sObject and field properties to the console.

Sample Code—C#

This sample calls describeSObject() to perform describes on the Account sObject. It retrieves some properties of the sObject describe result, such as the sObject name, label, and fields. It then iterates through the fields and gets the field properties. For picklist fields, it gets the picklist values and for reference fields, it gets the referenced object names. The sample writes the retrieved sObject and field properties to the console.

Arguments

Name Type Description
sObjectType string Object. The specified value must be a valid object for your organization. For a complete list of objects, see Standard Objects.