Field definitions and subtypes for this metadata type are in CustomObject. Unless otherwise noted, all fields are creatable, filterable, and nillable.
Specify all relevant fields when you create or update a custom object. Include every field you want to keep, because you can’t update one field on its own. For more information about custom objects, see Store Information That’s Unique to Your Organization.
You can also use this metadata type to work with customizations of standard objects, such as accounts. For an example, see the section on Standard Objects in Sample package.xml Manifest Files.
Use a fully specified fullName. These examples show a standard object, a custom object, and an external object.
Custom object names are automatically appended with __c. External object names are automatically appended with __x.
Retrieving a component of this metadata type in a project makes the component appear in any Profile and PermissionSet components that are retrieved in the same package.
Note
Version
Custom objects are available in API version 10.0 and later. External objects are available in API version 32.0 and later.
Additional Field Behavior
Custom settings
When customSettingsType is present, the component is a custom setting. This field is available in API version 17.0 and later.
List—Static data stored in cache. Your app can access it org-wide.
Hierarchy—Static data stored in cache. Access depends on a hierarchy of user, profile, or org. This value is the default.
customSettingsVisibility is available in API versions 17.0 through 33.0. In API version 34.0 and later, use visibility.
Public—If the custom setting is packaged, it’s accessible to all subscribing orgs.
Protected—If the custom setting is in a managed package, it’s accessible only to the developer org. Subscribing orgs can’t access it. This value is the default.
Labels and names
description has a maximum length of 1000 characters.
Make label values unique across all standard, custom, and external objects in the org.
nameField is required for custom objects. On an external object, you can set isNameField to true on a CustomField instead. The name appears in page layouts, related lists, lookup dialogs, search results, and key lists on tab home pages. By default, this field is added to the custom object page layout as a required field.
Custom objects require pluralLabel so that object names can be localized.
Search
enableSearch corresponds to Allow Search in the user interface. Search is off by default for new custom objects. This field is available for custom objects in API version 35.0 and later.
To improve Einstein Search performance, searchability is turned off for custom objects that haven’t been searched for more than 120 days. To turn object and field searchability back on, contact your admin.
Search is off by default for new external objects. You can validate and sync an external data source to create external objects. Syncing turns on search for the external object when search is turned on for the external data source, and the reverse is also true. This field is available for external objects in API version 37.0 and later.
Set enableSearch to true before you set enableEnhancedLookup to true. In API version 28.0 and later, you can also use enableEnhancedLookup on Account, Contact, and User. For more information, see Enable Enhanced Lookups.
enableHistory is also available for standard objects in API version 29.0 and later. History tracking on Account includes person account history tracking.
enableActivities isn’t available for external objects. enableReports supports external objects in API version 38.0 and later.
To set recordTypeTrackFeedHistory to true, set enableFeeds to true on the associated custom object. To set recordTypeTrackHistory to true, set enableHistory to true on the associated custom object. Both fields are available in API version 19.0 and later.
Sharing and enterprise application usage
enableBulkApi, enableSharing, and enableStreamingApi classify the object as an Enterprise Application object for usage tracking. When you enable any one of these fields, enable the other two as well. These fields are available in API version 31.0 and later.
In API version 29.0 and earlier, sharingModel is read-only. Set it in the Salesforce user interface. In API version 30.0 and later, you can set this field for internal users with the API or in the user interface.
externalSharingModel sets the external org-wide default, which determines access for external users. This field is available in API version 31.0 and later.
External objects
externalDataSource and externalName are required for external objects. Both fields are available in API version 32.0 and later. externalDataSource is the name of the external data source that stores the object’s data. externalName is the name of the table in that data source.
externalRepository corresponds to Display URL Reference Field in the user interface. Salesforce generates the external object’s Display URL values from the external system. For example, with the OData 2.0 adapter for Salesforce Connect, the value is based on the link href defined on the OData producer. You can override those values with a custom field on the same external object. Select a field whose values are valid URLs. This field is available in API version 32.0 and later.
compactLayoutAssignment and compactLayouts are available in API version 29.0 and later, and for external objects in API version 42.0 and later.
Platform events
eventType applies only to platform events and is available in API version 41.0 and later.
HighVolume—A high-volume platform event.
StandardVolume—Deprecated. Creating a platform event with this event type returns an error.
publishBehavior applies only to platform events. It controls when a platform event message is published in a Lightning Platform transaction. It applies to messages published through the Lightning Platform, such as Apex, Process Builder, and Flow Builder. Messages published through Salesforce APIs aren’t covered by this field. If you omit this field, the default is PublishImmediately. This field is available in API version 46.0 and later.
PublishAfterCommit—The event message is published only after a transaction commits successfully. A failed transaction doesn’t publish the message.
PublishImmediately—The event message is published when the publish call executes, whether or not the transaction succeeds.
Visibility
visibility is available in API version 34.0 and later. For custom settings, this field replaces customSettingsVisibility. The default value is Public.
Public—If the custom object, custom setting, or custom metadata type is packaged, it’s accessible to all subscribing orgs.
Protected—If the custom object, custom setting, or custom metadata type is in a managed package, it’s accessible only to the developer org. Subscribing orgs can’t access it.
PackageProtected—Custom metadata types only. The value is accessible only to Apex in the same package. Use it for secrets such as API access keys and security tokens. Available in API version 47.0 and later.
Other fields
enableLicensing indicates whether Salesforce licenses the object and users need a permission set license for it. Available in API version 45.0 and later.
household supports relationship groups, available only with Salesforce for Wealth Management.
indexes defines an index for a custom big object.
namedFilter was removed in API version 30.0. It’s available in earlier versions, starting with API version 17.0. Lookup filter metadata is now lookupFilter on CustomField.
dataStewardGroup and dataStewardUser were removed in API version 47.0.
MktDataModelAttributes represents the Data 360 data model object (DMO) attributes for a custom object.
In API version 62.0 and later, valid creationType values are:
Activation_Audience
Ad_Audience_Insights
ADG
Calculated_Insight
CG_Audience
Chunk
Directory_Table
External
Problem_Records
Segment_Membership
Semantic
Transform
Vector_Embedding
In API version 67.0 and later, these additional values are valid:
Auxiliary
Clean_Room
Deletion_Records
For a standard Data 360 model, set dataModelTaxonomy to Reference when creationType is Standard, or to View when creationType is Custom.
description has a maximum length of 521 characters and is available in API version 55.0 and later.
isUsedForMetrics includes object attributes that aren’t present in the DMO POJO. It’s available in API version 55.0 and later.
labelOverride has a maximum length of 255 characters and is available in API version 66.0 and later.
masterLabel has a maximum length of 40 characters and is available in API version 66.0 and later.
Valid objectCategory values are Engagement, Profile, and Other.
referenceEntityGroup, referenceEntityName, and referenceEntitySubjectArea apply to standard objects.
MktDataLakeAttributes
MktDataLakeAttributes represents the Data 360 data lake object (DLO) attributes for a custom object. Its components are available in API version 50.0 and later. To access this object, the org needs a Data Cloud license.
Valid creationType values are:
Activation_Audience
Bridge
Curated
Custom
Derived
Ml_Prediction
Segment_Membership
Standard
System
In API version 62.0 and later, these additional values are valid:
Ad_Audience_Insights
ADG
Calculated_Insight
CG_Audience
Chunk
Directory_Table
External
Problem_Records
Semantic
Transform
Vector_Embedding
In API version 67.0 and later, these additional values are valid:
Auxiliary
Clean_Room
Deletion_Records
Valid objectCategory values are Behavioral, Profile, and Other.
Declarative Metadata Sample Definition
1<?xml version="1.0" encoding="UTF-8"?>2<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">3 <deploymentStatus>Deployed</deploymentStatus>4 <description>test object with one field for eclipse ide testing</description>5 <fields>6 <fullName>Comments__c</fullName>7 <description>add your comments about this object here</description>8 <inlineHelpText>This field contains comments made about this object</inlineHelpText>9 <label>Comments</label>10 <length>32000</length>11 <type>LongTextArea</type>12 <visibleLines>30</visibleLines>13 </fields>14 <label>MyFirstObject</label>15 <nameField>16 <label>MyFirstObject Name</label>17 <type>Text</type>18 </nameField>19 <pluralLabel>MyFirstObjects</pluralLabel>20 <sharingModel>ReadWrite</sharingModel>21</CustomObject>
The following is the metadata definition of an external object for Salesforce Connect.
This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file for field sets and record types but not for other components. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.