DescribeSObjectResult

Where possible, we changed noninclusive terms to align with our company value of Equality. Because changing terms in our code can break current implementations, we maintained this object’s name.

Important

The describeSObjects() call returns an array of DescribeSObjectResult objects. Each object has the following properties:

NameTypeDescription
actionOverridesActionOverride[]An array of action overrides. Action overrides replace the URLs specified in the urlDetail, urlEdit and urlNew fields. This field is available in API version 32.0 and later.
activateablebooleanReserved for future use.
actionOverridesActionOverride[]An array of action overrides. Action overrides replace the URLs specified in the urlDetail, urlEdit and urlNew fields. This field is available in API version 32.0 and later.
associateEntityTypestringIf the object is associated with a parent object, the type of association it has to its parent, such as History. Otherwise, its value is null. Available in API version 50.0 and later.
associateParentEntitystringIf the object is associated with a parent object, the parent object it’s associated with. Otherwise, its value is null. Available in API version 50.0 and later.
childRelationshipsChildRelationship[]An array of child relationships, which is the name of the sObject that has a foreign key to the sObject being described.
compactLayoutablebooleanIndicates that the object can be used in describeCompactLayouts().
createablebooleanIndicates whether the object can be created via the create() call (true) or not (false).
custombooleanIndicates whether the object is a custom object (true) or not (false).
customSettingbooleanIndicates whether the object is a custom setting object (true) or not (false).
dataTranslationEnabledbooleanIndicates whether data translation is enabled for the object (true) or not (false). Available in API version 49.0 and later.
deepCloneablebooleanReserved for future use.
defaultImplementationstringReserved for future use.
deletablebooleanIndicates whether the object can be deleted via the delete() call (true) or not (false).
deprecatedAndHiddenbooleanReserved for future use.
extendedBystringReserved for future use.
extendsInterfacesstringReserved for future use.
feedEnabledbooleanIndicates whether Chatter feeds are enabled for the object (true) or not (false). This property is available in API version 19.0 and later.
fieldsField[]Array of fields associated with the object. The mechanism for retrieving information from this list varies among development tools.
implementedBystringReserved for future use.
implementsInterfacesstringReserved for future use.
isInterfacebooleanReserved for future use.
keyPrefixstringThree-character prefix code in the object ID. Object IDs are prefixed with three-character codes that specify the type of the object. For example, Account objects have a prefix of 001 and Opportunity objects have a prefix of 006. Note that a key prefix can sometimes be shared by multiple objects so it does not always uniquely identify an object. Use the value of this field to determine the object type of a parent in those cases where the child may have more than one object type as parent (polymorphic). For example, you may need to obtain the keyPrefix value for the parent of a Task or Event.
labelstringLabel text for a tab or field renamed in the user interface, if applicable, or the object name, if not. For example, an organization representing a medical vertical might rename Account to Patient. Tabs and fields can be renamed in the Salesforce user interface. See the Salesforce online help for more information.
labelPluralstringLabel text for an object that represents the plural version of an object name, for example, “Accounts.”
layoutablebooleanIndicates whether the object supports the describeLayout() call (true) or not (false).
mergeablebooleanIndicates whether the object can be merged with other objects of its type (true) or not (false). true for leads, contacts, and accounts.
mruEnabledbooleanIndicates whether Most Recently Used (MRU) list functionality is enabled for the object (true) or not (false).
namestringName of the object. This is the same string that was passed in as the sObjectType parameter.
namedLayoutInfosNamedLayoutInfo[]The specific named layouts that are available for the objects other than the default layout.
networkScopeFieldNamestringThe API name of the networkScopeField that scopes the entity to an Experience Cloud site. For most entities, the value of this property is null.
queryablebooleanIndicates whether the object can be queried via the query() call (true) or not (false).
recordTypeInfos[]An array of the record types supported by this object. The user need not have access to all the returned record types to see them here.
replicateablebooleanIndicates whether the object can be replicated via the getUpdated() and getDeleted() calls (true) or not (false).
retrieveablebooleanIndicates whether the object can be retrieved via the retrieve() call (true) or not (false).
searchablebooleanIndicates whether the object can be searched via the search() call (true) or not (false).
searchLayoutablebooleanIndicates whether search layout information can be retrieved via the describeSearchLayouts() call (true) or not (false).
supportedScopesScopeInfoThe list of supported scopes for the object. For example, Account might have supported scopes of “All Accounts”, “My Accounts”, and “My Team’s Accounts”.
triggerablebooleanIndicates whether the object supports Apex triggers.
undeletablebooleanIndicates whether an object can be undeleted using the undelete() call (true) or not (false).
updateablebooleanIndicates whether the object can be updated via the update() call (true) or not (false).
urlDetailstringURL to the read-only detail page for this object. Compare with urlEdit, which is read-write. Client applications can use this URL to redirect to, or access, the Salesforce user interface for standard and custom objects. To provide flexibility and allow for future enhancements, returned urlDetail values are dynamic. To ensure that client applications are forward compatible, it is recommended that they use this capability where possible. Note that, for objects for which a stable URL is not available, this field is returned empty.
urlEditstringURL to the edit page for this object. For example, the urlEdit field for the Account object returns https://yourInstance.salesforce.com/{ID}/e. Substituting the {ID} field for the current object ID will return the edit page for that specific account in the Salesforce user interface. Compare with urlDetail, which is read-only. Client applications can use this URL to redirect to, or access, the Salesforce user interface for standard and custom objects. To provide flexibility and allow for future enhancements, returned urlDetail values are dynamic. To ensure that client applications are forward compatible, it is recommended that they use this capability where possible. Note that, for objects for which a stable URL is not available, this field is returned empty.
urlNewstringURL to the new/create page for this object. Client applications can use this URL to redirect to, or access, the Salesforce user interface for standard and custom objects. To provide flexibility and allow for future enhancements, returned urlNew values are dynamic. To ensure that client applications are forward compatible, it is recommended that they use this capability where possible. Note that, for objects for which a stable URL is not available, this field is returned empty.

The properties with a Boolean value indicate whether certain API calls can be used for an object. However, other factors, such as permissions, also affect whether such operations can be performed on the object.

Note

ActionOverride 

ActionOverride provides details about an action that replaces the default action pages for an object. For example, an object could be configured to replace the new/create page with a custom page. This type is available in API version 32.0 and later.

NameTypeDescription
formFactorstringRepresents the environment to which the action override applies. For example, a Large value in this field represents the Lightning Experience desktop environment, and is valid for Lightning pages and Lightning components. A Small value represents the Salesforce mobile app on a phone or tablet. This field is available in API version 37.0 and later.
isAvailableInTouchbooleanIndicates whether the action override is available in the Salesforce mobile app (true) or not (false).
namestringThe name of the action that overrides the default action. For example, if the new/create page was overridden with a custom action, the name might be “New”.
pageIdreferenceThe ID of the page for the action override.
urlstringThe URL of the item being used for the action override, such as a Visualforce page. Returns as null for Lightning page overrides.

ChildRelationship 

The name of the sObject that has a foreign key to the sObject being described.

NameTypeDescription
cascadeDeletebooleanIndicates whether the child object is deleted when the parent object is deleted (true) or not (false).
childSObjectstringThe name of the object on which there is a foreign key back to the parent sObject.
deprecatedAndHiddenbooleanReserved for future use.
fieldstringThe name of the field that has a foreign key back to the parent sObject.
junctionIdListNamesString[]The names of the lists of junction IDs associated with an object. Each ID represents an object that has a relationship with the associated object. For more information on JunctionIdList fields, see Field Types.
junctionReferenceToString[]A collection of object names that the polymorphic keys in the junctionIdListNames property can reference. You can query these object names.
relationshipNamestringThe name of the relationship, usually the plural of the value in childSObject.
restrictedDeletebooleanIndicates whether the parent object can’t be deleted because it is referenced by a child object (true) or not (false).

Field 

In the DescribeSObjectResult, the fields property contains an array of Field objects. Each field represents a field in an API object. The array contains only the fields that the user can view, as defined by the user’s field-level security settings.

NameTypeDescription
autonumberbooleanIndicates whether this field is an autonumber field (true) or not (false). Analogous to a SQL IDENTITY type, autonumber fields are read only, non-createable text fields with a maximum length of 30 characters. Autonumber fields are read-only fields used to provide a unique ID that is independent of the internal object ID (such as a purchase order number or invoice number). Autonumber fields are configured entirely in the Salesforce user interface. The API provides access to this attribute so that client applications can determine whether a given field is an autonumber field.
byteLengthintFor variable-length fields (including binary fields), the maximum size of the field, in bytes.
calculatedbooleanIndicates whether the field is a custom formula field (true) or not (false). Note that custom formula fields are always read-only.
calculatedFormulastringThe formula used to calculate the value of a formula field. Returns the formula expression as a string. This property is populated only when calculated is (true). If the field is not a formula field, this value is null.
caseSensitivebooleanIndicates whether the field is case sensitive (true) or not (false).
controllerNamestringThe name of the field that controls the values of this picklist. It only applies if type is picklist or multipicklist and dependentPicklist is true. The mapping of controlling field to dependent field is stored in the validFor attribute of each PicklistEntry for this picklist.
createablebooleanIndicates whether the field can be created (true) or not (false). If true, then this field value can be set in a create() call.
custombooleanIndicates whether the field is a custom field (true) or not (false).
dataTranslationEnabledbooleanIndicates whether data translation is enabled for the field (true) or not (false). Available in API version 49.0 and later.
defaultedOnCreatebooleanIndicates whether this field is defaulted when created (true) or not (false). If true, then Salesforce implicitly assigns a value for this field when the object is created, even if a value for this field is not passed in on the create() call. For example, in the Opportunity object, the Probability field has this attribute because its value is derived from the Stage field. Similarly, the Owner has this attribute on most objects because its value is derived from the current user (if the Owner field is not specified).
defaultValueFormulastringThe default value specified for this field if the formula is not used. If no value has been specified, this field is not returned.
dependentPicklistbooleanIndicates whether a picklist is a dependent picklist (true) where available values depend on the chosen values from a controlling field, or not (false). See About Dependent Picklists.
deprecatedAndHiddenbooleanReserved for future use.
digitsintFor fields of type integer. Maximum number of digits. The API returns an error if an integer value exceeds the number of digits.
displayLocationInDecimalbooleanIndicates how the geolocation values of a Location custom field appears in the user interface. If true, the geolocation values appear in decimal notation. If false, the geolocation values appear as degrees, minutes, and seconds.
encryptedbooleanThis page is about Shield Platform Encryption, not Classic Encryption. What’s the difference?. Indicates whether this field is encrypted. This value only appears in the results of a describeSObjects() call when it is true; otherwise, it is omitted from the results. This field is available in API version 31.0 and later.
extraTypeInfostringIf the field is a textarea field type, indicates if the text area is plain text (plaintextarea) or rich text (richtextarea). If the field is a url field type, if this value is imageurl, the URL references an image file. Available on standard fields on standard objects only, for example, Account.photoUrl, Contact.photoUrl, and so on. If the field is a reference field type, indicates the type of external object relationship. Available on external objects only.
  • null—lookup relationship
  • externallookup—external lookup relationship
  • indirectlookup—indirect lookup relationship
filterablebooleanIndicates whether the field is filterable (true) or not (false). If true, then this field can be specified in the WHERE clause of a query string in a query() call.
filteredLookupInfoFilteredLookupInfoIf the field is a reference field type with a lookup filter, filteredLookupInfo contains the lookup filter information for the field. If there is no lookup filter, or the filter is inactive, this field is null. This field is available in API version 31.0 and later.
formulastringThe formula specified for this field. If no formula is specified for this field, it is not returned.
groupablebooleanIndicates whether the field can be included in the GROUP BY clause of a SOQL query (true) or not (false). See GROUP BY in the Salesforce SOQL and SOSL Reference Guide. Available in API version 18.0 and later.
highScaleNumberbooleanIndicates whether the field stores numbers to 8 decimal places regardless of what’s specified in the field details (true) or not (false). Used to handle currencies for products that cost fractions of a cent, in large quantities. If high-scale unit pricing isn’t enabled in your organization, this field isn’t returned. Available in API version 33.0 and later.
htmlFormattedbooleanIndicates whether a field such as a hyperlink custom formula field has been formatted for HTML and should be encoded for display in HTML (true) or not (false). Also indicates whether a field is a custom formula field that has an IMAGE text function.
idLookupbooleanIndicates whether the field can be used to specify a record in an upsert() call (true) or not (false).
inlineHelpTextstringThe text that displays in the field-level help hover text for this field. This property is not returned unless at least one field on the object contains a value. When at least one field has field-level help, all fields on the object list the property with either the field-level help value or null for fields that have blank field-level help.
labelstringText label that is displayed next to the field in the Salesforce user interface. This label can be localized.
lengthintReturns the maximum size of the field in Unicode characters (not bytes) or 255, whichever is less. The maximum value returned by the getLength() property is 255. Available in API version 49.0 and later.
maskstringReserved for future use.
maskTypestringReserved for future use.
namestringField name used in API calls, such as create(), delete(), and query().
nameFieldbooleanIndicates whether this field is a name field (true) or not (false). Used to identify the name field for standard objects (such as AccountName for an Account object) and custom objects. Limited to one per object, except where FirstName and LastName fields are used (such as in the Contact object). If a compound name is present, for example the Name field on a person account, nameField is set to true for that record. If no compound name is present, FirstName and LastName have this field set to true.
namePointingbooleanIndicates whether the field’s value is the Name of the parent of this object (true) or not (false). Used for objects whose parents may be more than one type of object, for example a task may have an account or a contact as a parent.
nillablebooleanIndicates whether the field is nillable (true) or not (false). A nillable field can have empty content. A non-nillable field must have a value in order for the object to be created or saved.
permissionablebooleanIndicates whether FieldPermissions can be specified for the field (true) or not (false).
picklistValuesPicklistEntry[]Provides the list of valid values for the picklist. Specified only if restrictedPicklist is true.
polymorphicForeignKeybooleanIndicates whether the foreign key includes multiple entity types (true) or not (false).
precisionintFor fields of type double. Maximum number of digits that can be stored, including all numbers to the left and to the right of the decimal point (but excluding the decimal point character).
relationshipNamestringThe name of the relationship, if this is a master-detail relationship field.
relationshipOrderintThe type of relationship for a master-detail relationship field. Valid values are:
  • 0 if the field is the primary relationship
  • 1 if the field is the secondary relationship
referenceTargetFieldstringApplies only to indirect lookup relationships on external objects. Name of the custom field on the parent standard or custom object whose values are matched against the values of the child external object’s indirect lookup relationship field. This matching is done to determine which records are related to each other. This field is available in API version 32.0 and later.
referenceTostring[]For fields that refer to other objects, this array indicates the object types of the referenced objects.
restrictedPicklistbooleanIndicates whether the field is a restricted picklist (true) or not (false).
scaleintFor fields of type double. Number of digits to the right of the decimal point. The API silently truncates any extra digits to the right of the decimal point, but it returns a fault response if the number has too many digits to the left of the decimal point.
searchPrefilterablebooleanIndicates whether a foreign key can be included in prefiltering (true) or not (false) when used in a SOSL WHERE clause. Prefiltering means to filter by a specific field value before executing the full search query. Available in API version 40.0 and later.
soapTypeSOAPTypeSee SOAPType for a list of allowable values.
sortablebooleanIndicates whether a query can sort on this field (true) or not (false).
typeFieldTypeSee FieldType for a list of allowable values.
uniquebooleanIndicates whether the value must be unique true) or not false).
updateablebooleanIndicates one of the following:
  • Whether the field is updateable, (true) or not (false).
If true, then this field value can be set in an update() call.
  • If the field is in a master-detail relationship on a custom object, indicates whether the child records can be reparented to different parent records (true), false otherwise.
  • writeRequiresMasterReadbooleanThis field only applies to master-detail relationships. Indicates whether a user requires read sharing access (true) or write sharing access (false) to the parent record to insert, update, and delete a child record. In both cases, a user also needs Create, Edit, and Delete object permissions for the child object.

    FieldType 

    In the Field object associated with DescribeSObjectResult, the type field can contain one of the following strings. For more information about field types, see Field Types.

    type Field ValueWhat the Field Object Contains
    stringString values.
    booleanBoolean (true / false) values.
    intInteger values.
    doubleDouble values.
    dateDate values.
    datetimeDate and time values.
    base64Base64-encoded arbitrary binary data (of type base64Binary). Used for Attachment, Document, and Scontrol objects.
    IDPrimary key field for the object. For information on IDs, see Field Types.
    referenceCross-references to a different object. Analogous to a foreign key field in SQL.
    currencyCurrency values.
    textareaString that is displayed as a multiline text field.
    percentPercentage values.
    phonePhone numbers. Values can include alphabetic characters. Client applications are responsible for phone number formatting.
    urlURL values. Client applications should commonly display these as hyperlinks. If Field.extraTypeInfo is imageurl, the URL references an image, and can be displayed as an image instead.
    emailEmail addresses.
    comboboxComboboxes, which provide a set of enumerated values and allow the user to specify a value not in the list.
    picklistSingle-select picklists, which provide a set of enumerated values from which only one value can be selected.
    multipicklistMulti-select picklists, which provide a set of enumerated values from which multiple values can be selected.
    anyTypeValues can be any of these types: string, picklist, boolean, int, double, percent, ID, date, dateTime, url, or email.
    locationGeolocation values, including latitude and longitude, for custom geolocation fields on custom objects.

    FilteredLookupInfo 

    In the Field object associated with the DescribeSObjectResult, the filteredLookupInfo field contains information about the lookup filter associated with the field.

    This subtype is available in API version 31.0 and later.

    NameTypeDescription
    controllingFieldsstring[]Array of the field’s controlling fields when the lookup filter is dependent on the source object.
    dependentbooleanIndicates whether the lookup filter is dependent upon the source object (true) or not (false).
    optionalFilterbooleanIndicates whether the lookup filter is optional (true) or not (false).

    SOAPType 

    The DescribeSObjectResult returns the fields property, which contains an array of fields whose value provides information about the object being described. One of those fields, soapType, contains one of the following string values. All of the values preceded by xsd: are XML schema primitive data types. For more information about the XML schema primitive data types, see the World Wide Web Consortium’s publication XML Schema Part 2: Data Types at: http://www.w3.org/TR/xmlschema-2/.

    ValueDescription
    tns:IDUnique ID associated with an sObject. For information on IDs, see Field Types.
    xsd:anyTypeCan be ID, Boolean, double, integer, string, date, or dateTime.
    xsd:base64BinaryBase 64-encoded binary data.
    xsd:booleanBoolean (true / false) values.
    xsd:dateDate values.
    xsd:dateTimeDate/time values.
    xsd:doubleDouble values.
    xsd:intInteger values.
    xsd:stringCharacter strings.

    PicklistEntry 

    In the Field object associated with the DescribeSObjectResult, the picklistValues field contains an array of PicklistEntry properties. Each PicklistEntry can contain any one of the following string values. For more information, see Field Types.

    NameTypeDescription
    activebooleanIndicates whether this item must be displayed (true) or not (false) in the drop-down list for the picklist field in the user interface.
    validForbyte[]A set of bits where each bit indicates a controlling value for which this PicklistEntry is valid. See About Dependent Picklists.
    defaultValuebooleanIndicates whether this item is the default item (true) in the picklist or not (false). Only one item in a picklist can be designated as the default.
    labelstringDisplay name of this item in the picklist.
    valuestringValue of this item in the picklist.

    About Dependent Picklists 

    A dependent picklist works in conjunction with a controlling field to filter its values. The value chosen in the controlling field affects the values available in the dependent picklist.

    A dependent picklist can be any custom picklist or multi-select picklist field that displays available values based on the value selected in its corresponding controlling field. A controlling field can be any standard or custom picklist (with at least one and less than 200 values) or checkbox field whose values control the available values in one or more corresponding dependent fields.

    In the following example, the controlling picklist Beverage has two values, which relate to the values of the dependent picklist Beverage Variety:

    BeverageBeverage Variety
    CoffeeDecaffeinated
     Regular
    TeaChamomile
     Earl Grey
     English Breakfast

    For each PicklistEntry that represents a value in a dependent picklist, the validFor attribute contains a set of bits. Each bit indicates a controlling field value for which the PicklistEntry is valid. Read the bits from left to right.

    For more information on dependent picklists, see the “Dependent Picklists” topic in the Salesforce online help.

    Sample Java Code for Dependent Picklists 

    1public void dependentPicklistSample() {
    2  // inner class to decode a "validFor" bitset
    3  class Bitset {
    4    byte[] data;
    5
    6    public Bitset(byte[] data) {
    7      this.data = data == null ? new byte[0] : data;
    8    }
    9
    10    public boolean testBit(int n) {
    11      return (data[n >> 3] & (0x80 >> n % 8)) != 0;
    12    }
    13
    14    public int size() {
    15      return data.length * 8;
    16    }
    17  }
    18
    19  try {
    20    DescribeSObjectResult describeSObjectResult = connection.describeSObject("Case");
    21    Field[] fields = describeSObjectResult.getFields();
    22    // create a map of all fields for later lookup
    23    Map fieldMap = new HashMap();
    24    for (int i = 0; i < fields.length; i++) {
    25      fieldMap.put(fields[i].getName(), fields[i]);
    26    }
    27    for (int i = 0; i < fields.length; i++) {
    28      // check whether this is a dependent picklist
    29      if (fields[i].getDependentPicklist()) {
    30        // get the controller by name
    31        Field controller = (Field)fieldMap.get(fields[i].getControllerName());
    32        System.out.println("Field '" + fields[i].getLabel() + "' depends on '" +
    33        controller.getLabel() + "'");
    34        PicklistEntry[] picklistValues = fields[i].getPicklistValues();
    35        for (int j = 0; j < picklistValues.length; j++) {
    36          // for each PicklistEntry: list all controlling values for which it is valid
    37          System.out.println("Item: '" + picklistValues[j].getLabel() +
    38          "' is valid for: ");
    39          Bitset validFor = new Bitset(picklistValues[j].getValidFor());
    40          if (FieldType.picklist == controller.getType()) {
    41            // if the controller is a picklist, list all
    42            // controlling values for which this entry is valid
    43            for (int k = 0; k < validFor.size(); k++) {
    44              if (validFor.testBit(k)) {
    45                // if bit k is set, this entry is valid for the
    46                // for the controlling entry at index k
    47                System.out.println(controller.getPicklistValues()[k].getLabel());
    48              }
    49            }
    50          } else if (FieldType._boolean == controller.getType()) {
    51            // the controller is a checkbox
    52            // if bit 1 is set this entry is valid if the controller is checked
    53            if (validFor.testBit(1)) {
    54              System.out.println(" checked");
    55            }
    56            // if bit 0 is set this entry is valid if the controller is not checked
    57            if (validFor.testBit(0)) {
    58              System.out.println(" unchecked");
    59            }
    60          }
    61        }
    62      }
    63    }
    64  } catch (ConnectionException ce) {
    65    ce.printStackTrace();
    66  }
    67}

    RecordTypeInfo 

    Base class for the old RecordTypeMapping object. This object contains all of the existing fields of RecordTypeMapping except layoutId and picklistForRecordType.

    NameTypeDescription
    availablebooleanIndicates whether this record type is available (true) or not (false). Availability is used to display a list of available record types to the user when they are creating a new record.
    defaultRecordTypeMappingbooleanIndicates whether this is the default record type mapping (true) or not (false).
    developerNamestringDeveloper name of this record type. Available in API versions 43.0 and later.
    masterbooleanIndicates whether this is the main record type (true) or not (false). The main record type is the default record type that’s used when a record has no custom record type associated with it.
    namestringName of this record type.
    recordTypeIdIDID of this record type.

    NamedLayoutInfo 

    The name of the named layout for the object. Standard objects can have defined named layouts which are separate from the primary layout for both the profile and the record type. For more information on layout names, see describeLayout().

    NameTypeDescription
    namestringName of this layout.

    ScopeInfo 

    A scope for an object that can be used to filter object records. For example, Account may have a supported ScopeInfo of “mine” (with a UI label of “My accounts”) which filters only Account records for the current user.

    NameTypeDescription
    labelstringUI label for this scope.
    namestringName of this scope.