Get Object Metadata

The objectInfo type returns object metadata, such as whether an object is MRU enabled and whether an object is searchable or updateable. The response includes metadata describing fields, child relationships, record type, and theme.

Pass in the objectInfo type in the uiapi field. For example, use apiNames: ["Account"] to return the object info for the account object.

Query objectInfos by following this schema.

The objectInfos type is a an array of ObjectInfo type with one argument.

  • apiNames - A list of one or more object API names of supported objects. It's non-nullable, which means you can expect an array of zero or more items.

The ObjectInfo type includes fields for the object metadata.

The ObjectInfo type contains these fields.

  • apiName - A supported object.
  • childRelationships - The object's child relationships.
  • creatable - Indicates whether the object can be created.
  • custom - Indicates whether the object is a custom object.
  • defaultRecordTypeId - The ID for the default record type for this object. If there isn’t a default record type, this value is the master record type, which is 012000000000000AAA. If the record is a nested record (for example, in a request for an Account, the User object is a nested record), the value is null.
  • deletable - Indicates whether the object can be deleted.
  • dependentFields - The object's dependent fields returned as a list of key and values.
  • feedEnabled - Indicates whether the object can have feeds.
  • fields - A field's metadata. This map only contains fields relevant to the requested layout and mode. It's non-nullable, which means you can expect an array of zero or more items.
  • keyPrefix - The key prefix for IDs of this object.
  • label - The object's display label.
  • labelPlural - The plural form of the object's display label.
  • layoutable - Indicates whether the object can have a layout.
  • mruEnabled - Indicates whether the object can appear in Most Recently Used lists.
  • nameFields - A list of the API names of the fields used to identify the name field for standard and custom objects. Typically there is one name field per object, except where FirstName and LastName fields are used.
  • queryable - Indicates whether the context user can query the object.
  • recordTypeInfos - A list of record type information about the record type. All record types are visible whether the user has access to them.
  • searchable - Indicates whether the object can be searched.
  • themeInfo - Theme information for the object.
  • updateable - Indicates whether the object can be updated.

ChildRelationship

The ChildRelationship type represents the child relationship on a parent object. For example, you can return data about related object records on a record's detail page. GraphQL API enables you to query the object info of all the child relationships using the objectInfo field.

The ChildRelationship type contains these fields.

  • childObjectApiName - The API name of the child object.
  • fieldName - The field on the child object that contains the reference to the parent object. Salesforce uses a reference field to store the ID of the related parent record.
  • junctionIdListNames - The names of the JunctionIdList fields associated with an object. Each ID is a polymorphic key, which is an ID that can refer to more than one type of object.
  • junctionReferenceTo - A collection of object names that the polymorphic keys in the junctionIdListNames property can reference.
  • relationshipName - The name of the relationship. The name is the plural form of the child object name. For example, Account has a relationshipName for each object: Assets, Cases, and Contacts.
  • objectInfo - The object's metadata.

DependentField

The DependentField type contains information about a dependent field that relies on the value of a controlling field. For example, a picklist with a list of cities are dependent on a controlling picklist field that displays a list of countries. Selecting a value on a controlling field filters down the values in a dependent field.

The DependentField type contains these fields.

  • controllingField - Standard and custom checkboxes and picklists with at least one and less than 300 values can be controlling fields.
  • dependentFields - A list of dependent fields, such as custom picklists or multi-select picklists.

Dependent fields are returned as a list of key and values.

Field

The Field type defines a field's metadata.

The Field type contains these fields.

  • apiName - The API name for this field.
  • calculated - Indicates whether the field is a custom formula field.
  • compound - Indicates whether the field is a top-level compound field. If the datatype is Location, this value is usually false.
  • compoundComponentName - If the field is a component field of a compound field, the value is the normalized component name, otherwise the value is null. For example, if the field represents BillingStreet of an Address compound field, this value contains Street.
  • compoundFieldName - If the field is a component field of a compound field, compoundFieldName contains the top-level compound field. Otherwise, the value is null.
  • controllerName - If the field is a dependent picklist, controllerName is the name of the field that controls the values of the picklist.
  • controllingFields - If the field is a dependent picklist, controllingFields is a list of fields that control the values in the picklist. When there’s a hierarchy of controlling fields, the list starts with the immediate parent and moves up the tree.
  • creatable - Indicates whether the field can be created.
  • custom - Indicates whether the field is a custom field.
  • datatype - The field type that's provided by the DATA_TYPE enum.
  • extraTypeInfo - Data type information that's provided by the FIELD_EXTRA_TYPE_INFO enum.
  • filterable - Indicates whether the field is filterable. If true, then this field can be specified in the where argument.
  • filteredLookupInfo - If the field is a reference field type with a lookup filter, this value contains the lookup information. See FilteredLookupInfo.
  • highScaleNumber - Indicates whether the field stores numbers to 8 decimal places regardless of what's specified in the field details.
  • htmlFormatted - Indicates whether the field has been formatted for HTML and should be encoded for display in HTML. Also indicates whether a field is a custom formula field that has an IMAGE text function.
  • inlineHelpText - The text that displays in the field-level help hover text.
  • label - Text label that displays next to the field in the Salesforce user interface.
  • length - For string fields, the maximum size of the field in number of Unicode characters (not bytes).
  • nameField - Indicates whether the field is a name field.
  • polymorphicForeignKey - Indicates whether the field is a foreign key over a domain of multiple objects.
  • precision - For double fields, indicates the maximum number of digits that can be stored, on both sides of the decimal point.
  • reference - Indicates whether the field is a foreign key to another record. A reference field contains an Id value that points to a unique record (usually the parent record) on another object.
  • referenceTargetField - For indirect lookup relationships on external objects, this property is the target custom field of the referenced object.
  • referenceToInfos - For fields that refer to other objects, this list includes information about the object types and name fields of the referenced objects. See ReferenceToInfo.
  • relationshipName - The name of the relationship, if this relationship is a master-detail relationship field.
  • required - Indicates whether the field is required when creating or editing a record.
  • searchPrefilterable - Indicates whether a foreign key (relationship field) can be included in the where argument.
  • scale - For double fields, indicates the number of digits to the right of the decimal point.
  • sortable - Indicates whether the field is sortable. If true, then the field can be specified in an orderBy argument.
  • unique - Indicates whether a field’s value must be unique.
  • updateable - Indicates whether the field can be edited.

FilteredLookupInfo

The FilteredLookupInfo type describes lookup filter information. If the type is null, the field it describes is a dependent lookup.

The FilteredLookupInfo type contains these fields.

  • controllingFields - For dependent picklists, controllingFields returns a list of fields that control the values in the picklist.
  • dependent - Indicates whether the field is dependent on another field.
  • optionalFilter -

ReferenceToInfo

ThemeInfo

RecordTypeInfo

The Field type contains several enum definitions for the datatype and extraTypeInfo fields.

DATA_TYPE

The DATA_TYPE enumeration describes the data type for the field.

FIELD_EXTRA_TYPE_INFO

The FIELD_EXTRA_TYPE_INFO enumeration describes data type information.

This example fetches the object metadata for an Account.

Example Response for Account Object Metadata

The previous query returns this response.

This example fetches all the child relationships for Accounts.

Example Response for Account Child Relationships

The previous query returns this response.

This example returns the child relationships for accounts and cases. It also runs an objectInfo subquery to fetch the queryable field on childRelationships.

Example Response for Account and Case Child Relationships