DataType

Represents the datatype of a field. Use this object with EntityDefinition, EntityParticle, or FieldDefinition to simplify queries.

DataType fields are exposed in SOAP API version 45.0 and later. You can use Tooling API to query for DataType fields in guest user mode in API version 44.0 and earlier. In API version 45.0 and later, use SOAP API to get this data in guest user mode. DataType is still exposed in Tooling API to User Profiles with the ViewSetup permission.

Note

Version 

Introduced in API version 34.0.

Supported SOAP API Calls 

describeSObjects(), query()

Supported REST API Methods 

Query

Limitations 

SOQL Limitations

SOSL Limitations

Special Access Rules 

  • As of Spring ’20 and later, only authenticated internal and external users can access this object.

Fields 

ContextServiceDataTypeId 

  • Type: string
  • Required: No
  • Properties: Filter, Group, Nillable, Sort

ContextWsdlDataTypeId 

  • Type: string
  • Required: No
  • Properties: Filter, Group, Nillable, Sort

DeveloperName 

  • Type: string

  • Required: No

  • Properties: Filter, Group, Nillable, Sort

  • Description: The unique name of the object in the API. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. In managed packages, this field prevents naming conflicts on package installations. With this field, a developer can change the object’s name in a managed package and the changes are reflected in a subscriber’s organization. Label is Record Type Name.

DurableId 

  • Type: string

  • Required: No

  • Properties: Filter, Group, Nillable, Sort

  • Description: Unique identifier for the field. Always retrieve this value before using it, as the value isn’t guaranteed to stay the same from one release to the next. To simplify queries, use this field.

IsComplex 

  • Type: boolean

  • Required: No

  • Properties: Defaulted on create, Filter, Group, Sort

  • Description: If true, the datatype contains other datatypes, in contrast to a simple datatype like string.

  • Default value: false

Example 

From an object, retrieve all the fields of one datatype.

1SELECT DataType, QualifiedApiName 
2FROM EntityParticle 
3WHERE DataType = 'phone' AND
4      EntityDefinition.QualifiedApiName = 'Account'

SOQL Limitations 

This object doesn’t support some SOQL operations.

  • GROUP BY: Example Query: SELECT COUNT(qualifiedapiname), isfeedenabled FROM EntityDefinition GROUP BY isfeedenabled

    Error Returned: The requested operation is not yet supported by this SObject storage type, contact salesforce.com support for more information.

  • LIMIT, LIMIT OFFSET: Example Queries:

    SELECT qualifiedapiname FROM EntityDefinition LIMIT 5

    SELECT qualifiedapiname FROM EntityDefinition LIMIT 5 OFFSET 10

    An incorrect result is returned because LIMIT and LIMIT OFFSET are ignored.

  • NOT: Example Query: SELECT qualifiedapiname FROM EntityDefinition WHERE qualifiedapiname!='Account'

    Error Returned: Only equals comparisons permitted

  • OR: Example Query: SELECT qualifiedapiname, keyprefix FROM EntityDefinition WHERE isdeletable=true OR (isfeedenabled=false AND keyprefix='01j')

    Error Returned: Disjunctions not supported

  • INCLUDES: Example Query: SELECT ComplianceGroup FROM FieldDefinition WHERE EntityDefinitionId = 'Account' AND ComplianceGroup includes('GDPR')

    Error Returned: Unsupported filter type