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.
accessible
Signature
public Boolean accessible {get; set;}
Property Value
Type: Boolean
associateentitytype
Signature
public String associateentitytype {get; set;}
Property Value
Type: String
associateparententity
Signature
public String associateparententity {get; set;}
Property Value
Type: String
childrelationships
Signature
public List<Schema.ChildRelationship> childrelationships {get; set;}
Property Value
Type: List<Schema.ChildRelationship>
createable
Signature
public Boolean createable {get; set;}
Property Value
Type: Boolean
custom
Signature
public Boolean custom {get; set;}
Property Value
Type: Boolean
customsetting
Signature
public Boolean customsetting {get; set;}
Property Value
Type: Boolean
datatranslationenabled
Signature
public Boolean datatranslationenabled {get; set;}
Property Value
Type: Boolean
defaultimplementation
Signature
public String defaultimplementation {get; set;}
Property Value
Type: String
deletable
Signature
public Boolean deletable {get; set;}
Property Value
Type: Boolean
feedenabled
Signature
public Boolean feedenabled {get; set;}
Property Value
Type: Boolean
fields
Example
This sample code shows how to use fields. To get a custom field, specify the custom field name.
Schema.DescribeFieldResult dfr = Schema.SObjectType.Account.fields.Name;
fieldSets
hassubtypes
Signature
public Boolean hassubtypes {get; set;}
Property Value
Type: Boolean
implementedby
Signature
public String implementedby {get; set;}
Property Value
Type: String
implementsinterfaces
Signature
public String implementsinterfaces {get; set;}
Property Value
Type: String
isinterface
Signature
public Boolean isinterface {get; set;}
Property Value
Type: Boolean
keyprefix
Signature
public String keyprefix {get; set;}
Property Value
Type: String
label
Signature
public String label {get; set;}
Property Value
Type: String
labelplural
Signature
public String labelplural {get; set;}
Property Value
Type: String
localname
Signature
public String localname {get; set;}
Property Value
Type: String
mergeable
Signature
public Boolean mergeable {get; set;}
Property Value
Type: Boolean
mruenabled
Signature
public Boolean mruenabled {get; set;}
Property Value
Type: Boolean
queryable
Signature
public Boolean queryable {get; set;}
Property Value
Type: Boolean
recordtypeinfos
Signature
public List<Schema.RecordTypeInfo> recordtypeinfos {get; set;}
Property Value
Type: List<Schema.RecordTypeInfo>
recordtypeinfosbydevelopername
Signature
public Map<String,Schema.RecordTypeInfo> recordtypeinfosbydevelopername {get; set;}
Property Value
Type: Map<String, Schema.RecordTypeInfo>
recordtypeinfosbyid
Signature
public Map<Id,Schema.RecordTypeInfo> recordtypeinfosbyid {get; set;}
Property Value
Type: Map<ID, Schema.RecordTypeInfo>
recordtypeinfosbyname
Signature
public Map<String,Schema.RecordTypeInfo> recordtypeinfosbyname {get; set;}
Property Value
Type: Map<String, Schema.RecordTypeInfo>
searchable
Signature
public Boolean searchable {get; set;}
Property Value
Type: Boolean
sobjectdescribeoption
Signature
public Schema.SObjectDescribeOptions sobjectdescribeoption {get; set;}
Property Value
sobjecttype
Signature
public Schema.SObjectType sobjecttype {get; set;}
Property Value
Type: Schema.SObjectType
undeletable
Signature
public Boolean undeletable {get; set;}
Property Value
Type: Boolean
updateable
Signature
public Boolean updateable {get; set;}
Property Value
Type: Boolean
DescribeSObjectResult Methods
The following are methods for DescribeSObjectResult. All are instance methods.
equals(obj)
Signature
public Boolean equals(Object obj)
Parameters
- obj
- Type: Object
- The object with which to compare.
Return Value
Type: Boolean
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.
getDataTranslationEnabled()
Signature
public Boolean getDataTranslationEnabled()
Return Value
Type: Boolean
getDefaultImplementation()
Signature
public String getDefaultImplementation()
Return Value
Type: String
getFields()
Signature
public Schema.SObjectTypeFields getFields()
Return Value
Type: Schema.SObjectTypeFields
The return value is a special data type. Call the getMap() method to get a map of Strings and SObjectFields.
Usage
When you describe SObjects and their fields from within an Apex class, custom fields of new field types are returned regardless of the API version that the class is saved in. If a field type, such as the geolocation field type, is available only in a recent API version, components of a geolocation field are returned even if the class is saved in an earlier API version.
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
getHasSubtypes()
Signature
public Boolean getHasSubtypes()
Return Value
Type: Boolean
hashCode()
Signature
public Integer hashCode()
Return Value
Type: Integer
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
toString()
Signature
public String toString()
Return Value
Type: String