Newer Version Available
DescribeSObjectResult Class
Namespace
Usage
Instances of describe results on the same DescribeSObjectResult aren’t guaranteed to be equal because the state and behavior of a describe object is determined by various factors including the API version used. To compare describe results, call the getSObjectType() method on the SObject describe results and use the equality operator (==) to compare the SObjectType values.
DescribeSObjectResult Properties
The following are properties for DescribeSObjectResult.
associateentitytype
Signature
public String associateentitytype {get; set;}
Property Value
Type: String
associateparententity
Signature
public String associateparententity {get; set;}
Property Value
Type: String
DescribeSObjectResult Methods
The following are methods for DescribeSObjectResult. All are instance methods.
fields
Signature
public Schema.SObjectTypeFields fields()
Return Value
Type: The return value is a special data type. See the example to learn how to use fields.
Usage
Example
1Schema.DescribeFieldResult dfr = Schema.SObjectType.Account.fields.Name;To get a custom field name, specify the custom field name.
fieldSets
Signature
public Schema.SObjectTypeFields fieldSets()
Return Value
Type: The return value is a special data type. See the example to learn how to use fieldSets.
getAssociateEntityType()
Signature
public String associateentitytype {get; set;}
Return Value
Type: String
getAssociateParentEntity()
Signature
public String getAssociateParentEntity()
Return Value
Type: String
getChildRelationships()
Signature
public Schema.ChildRelationship getChildRelationships()
Return Value
Type: List<Schema.ChildRelationship>
Example
For example, the Account object includes Contacts and Opportunities as child relationships.
getDefaultImplementation()
Signature
public String getDefaultImplementation()
Return Value
Type: String
getHasSubtypes()
Signature
public Boolean getHasSubtypes()
Return Value
Type: Boolean
getImplementsInterfaces()
Signature
public String getImplementsInterfaces()
Return Value
Type: String
getKeyPrefix()
Signature
public String getKeyPrefix()
Return Value
Type: String
Usage
The DescribeSobjectResult object returns a value for objects that have a stable prefix. For object types that do not have a stable or predictable prefix, this field is blank. Client applications that rely on these codes can use this way of determining object type to ensure forward compatibility.
getLabel()
Signature
public String getLabel()
Return Value
Type: String
Usage
The object's label might not always match the object name. For example, an organization in the medical industry might change the label for Account to Patient. This label is then used in the Salesforce user interface. See the Salesforce online help for more information.
getLabelPlural()
Signature
public String getLabelPlural()
Return Value
Type: String
Usage
The object's plural label might not always match the object name. For example, an organization in the medical industry might change the plural label for Account to Patients. This label is then used in the Salesforce user interface. See the Salesforce online help for more information.
getLocalName()
Signature
public String getLocalName()
Return Value
Type: String
getRecordTypeInfos()
Signature
public List<Schema.RecordTypeInfo> getRecordTypeInfos()
Return Value
Type: List<Schema.RecordTypeInfo>
getRecordTypeInfosByDeveloperName()
Signature
public Map<String, Schema.RecordTypeInfo> getRecordTypeInfosByDeveloperName()
Return Value
Type: Map<String, Schema.RecordTypeInfo>
getRecordTypeInfosById()
Signature
public Schema.RecordTypeInfo getRecordTypeInfosById()
Return Value
Type: Map<ID, Schema.RecordTypeInfo>
getRecordTypeInfosByName()
Signature
public Schema.RecordTypeInfo getRecordTypeInfosByName()
Return Value
Type: Map<String, Schema.RecordTypeInfo>
getSObjectDescribeOption()
Signature
public Schema.SObjectDescribeOptions getSObjectDescribeOption()
Return Value
Type: Schema.SObjectDescribeOptions
- SObjectDescribeOptions.FULL: Indicates eager-load all elements of the describe, including child relationships, up-front at the time of method invocation.
- SObjectDescribeOptions.DEFERRED: Indicates lazy-load child relationships. This means that all child relationships will not be loaded at the time of first invocation of the method.
getSobjectType()
Signature
public Schema.SObjectType getSobjectType()
Return Value
Type: Schema.SObjectType
isAccessible()
Signature
public Boolean isAccessible()
Return Value
Type: Boolean
Versioned Behavior Changes
In API version 54.0 and later, for custom settings and custom metadata type objects, DescribeSObjectResult.isAccessible() returns false if the user doesn’t have permissions to access the queried objects. In API version 53.0 and earlier, the method returns true even if the user doesn't have the required permissions.
isCreateable()
Signature
public Boolean isCreateable()
Return Value
Type: Boolean
isCustom()
Signature
public Boolean isCustom()
Return Value
Type: Boolean
isCustomSetting()
Signature
public Boolean isCustomSetting()
Return Value
Type: Boolean
isDeletable()
Signature
public Boolean isDeletable()
Return Value
Type: Boolean
isDeprecatedAndHidden()
Signature
public Boolean isDeprecatedAndHidden()
Return Value
Type: Boolean
isFeedEnabled()
Signature
public Boolean isFeedEnabled()
Return Value
Type: Boolean
isMergeable()
Signature
public Boolean isMergeable()
Return Value
Type: Boolean
isMruEnabled()
Signature
public Boolean isMruEnabled()
Return Value
Type: Boolean
isQueryable()
Signature
public Boolean isQueryable()
Return Value
Type: Boolean
isSearchable()
Signature
public Boolean isSearchable()
Return Value
Type: Boolean
isUndeletable()
Signature
public Boolean isUndeletable()
Return Value
Type: Boolean
isUpdateable()
Signature
public Boolean isUpdateable()
Return Value
Type: Boolean