CustomObject

Represents a custom object that stores data unique to your org or an external object that maps to data stored outside your org.
This type extends the Metadata metadata type and inherits its fullName field.

Specify all relevant fields when you create or update a custom object. You can’t update a single field on the object. 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.

All metadata components have a fullName field, which must be fully specified for any custom object.

For example, the following are fully specified names for a standard object and a custom object respectively:

1Account
2MyCustomObject__c

And the following is a fully specified name for an external object:

1MyExternalObject__x

For sample Java code that creates a custom object, see Step 3: Walk Through the Java Sample Code.

Declarative Metadata File Suffix and Directory Location

Custom object names are automatically appended with __c. The file suffix is .object for the custom object or standard object file.

External object names are automatically appended with __x. The file suffix is .object for the external object file.

Custom, standard, and external objects are stored in the objects folder in the corresponding package directory.

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.

Fields

Unless otherwise noted, all fields are creatable, filterable, and nillable.

actionOverrides

  • Field Type: ActionOverride[]
  • Description: List of action overrides on the object. This field is available in API version 18.0 and later.

allowInChatterGroups

  • Field Type: boolean
  • Description: Indicates whether records of this custom object type can be added to Chatter groups (true) or not (false). This field is available in API version 34.0 and later.

businessProcesses

  • Field Type: BusinessProcess[]
  • Description: List of business processes associated with the object. This field is available in API version 17.0 and later.

compactLayoutAssignment

  • Field Type: string
  • Description: Compact layout assigned to the object. This field is available in API version 29.0 and later. This field is available for external objects in API version 42.0 and later.

compactLayouts

  • Field Type: CompactLayout[]
  • Description: List of compact layouts associated with the object. This field is available in API version 29.0 and later. This field is available for external objects in API version 42.0 and later.

customHelp

  • Field Type: string
  • Description: S-control that contains the help content if the object has customized help content. This field is available in API version 14.0 and later.

customHelpPage

  • Field Type: string
  • Description: Visualforce page that contains the help content if the object has customized help content. This field is available in API version 16.0 and later.

customSettingsType

  • Field Type: CustomSettingsType (enumeration of type string)
  • Description: When this field is present, this component isn’t a custom object, but a custom setting. This field returns the type of custom setting. This field is available in API version 17.0 and later.
  • Possible values:
    • List—static data stored in cache, accessed as part of your app, and available org-wide.
    • Hierarchy—static data stored in cache, accessed as part of your app, and available based on a hierarchy of user, profile, or org. This value is the default.

customSettingsVisibility

  • Field Type: CustomSettingsVisibility (enumeration of type string)
  • Description: When this field is present, this component isn’t a custom object, but a custom setting. This field returns the visibility of the custom setting. This field is available in API versions 17.0 through 33.0. In versions 34.0 and later, use the visibility field instead of this field.
  • Possible values:
    • 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.

dataStewardGroup

  • Field Type: string
  • Description: Removed in API version 47.0.

dataStewardUser

  • Field Type: string
  • Description: Removed in API version 47.0.

deploymentStatus

  • Field Type: DeploymentStatus (enumeration of type string)
  • Description: Indicates the deployment status of the object.

deprecated

  • Field Type: boolean
  • Description: Reserved for future use. Indicates whether a developer deprecated a custom object in a package (true) or not (false).

description

  • Field Type: string
  • Description: Description of the object. Maximum length is 1000 characters.

enableActivities

  • Field Type: boolean
  • Description: Indicates whether the object is enabled for activities (true) or not (false). Not available for external objects.

enableBulkApi

  • Field Type: boolean
  • Description: When enabled, the object is classified as an Enterprise Application object for usage tracking. When enabled, enableSharing and enableStreamingApi must also be enabled.

    This field is available in API version 31.0 and later.

enableDivisions

  • Field Type: boolean
  • Description: Indicates whether the object is enabled for divisions (true) or not (false). For more information on this field, see Division.

enableEnhancedLookup

  • Field Type: boolean
  • Description: Indicates whether the object is enabled for enhanced lookups (true) or not (false). The custom object must be searchable for enableEnhancedLookup to work. Set enableSearch as true before setting enableEnhancedLookup as true. In API version 28.0 and later, this field can also be used for the Account, Contact, and User objects. Enhanced lookups provide an updated lookup dialog interface that lets users filter, sort, and page through search results and customize search result columns. For more information about enhanced lookups, see Enable Enhanced Lookups.

enableFeeds

  • Field Type: boolean
  • Description: Indicates whether the object is enabled for feed tracking (true) or not (false). For more information, see Customize Chatter Feed Tracking. This field is available in API version 18.0 and later.

enableHistory

  • Field Type: boolean
  • Description: Indicates whether the object is enabled for history tracking (true) or not (false). Also available for standard objects in API version 29.0 and later. History tracking on the Account object includes person account history tracking.

enableLicensing

  • Field Type: boolean
  • Description: Indicates whether this object is licensed by Salesforce and users require a permission set license for it (true) or not (false). This field is available in API version 45.0 and later.

enableReports

  • Field Type: boolean
  • Description: Indicates whether the object is enabled for reports (true) or not (false). Support for external objects is available in API version 38.0 and later.

enableSearch

  • Field Type: boolean
  • Description: Indicates whether the object’s records can be found via Salesforce Object Search Language and Salesforce searches (true) or not (false). Corresponds to Allow Search in the user interface. By default, search is turned off for new custom objects. This field is available for custom objects in API version 35.0 and later.

    To enhance Einstein Search performance, searchability is turned off for custom objects that haven't been searched for more than 120 days. To enable object and field searchability, contact your admin.

    By default, search is turned off for new external objects. However, you can validate and sync an external data source to automatically create external objects. Syncing always enables search on the external object when search is enabled on the external data source, and vice versa. This field is available for external objects in API version 37.0 and later.

enableSharing

  • Field Type: boolean
  • Description: Indicates whether the object is classified as an Enterprise Application object for usage tracking (true) or not (false). When enabled, enableBulkApi and enableStreamingApi must also be enabled.

    This field is available in API version 31.0 and later.

enableStreamingApi

  • Field Type: boolean
  • Description: Indicates whether the object is classified as an Enterprise Application object for usage tracking (true) or not (false). When enabled, enableBulkApi and enableSharing must also be enabled.

    This field is available in API version 31.0 and later.

eventType

  • Field Type: PlatformEventType (enumeration of type string)
  • Description: This field applies only to platform events. Type of event. This field is available in API version 41.0 and later.
  • Possible values:
    • HighVolume—For a high-volume platform event.
    • StandardVolume—Deprecated. Creating a platform event with this event type is supported and returns an error.

externalDataSource

  • Field Type: string
  • Description: Required and available only for external objects. The name of the external data source that stores the data for the external object. The data source is represented by the ExternalDataSource component. This field is available in API version 32.0 and later.

externalName

  • Field Type: string
  • Description: Required and available only for external objects. The name of the table in the external data source that contains the data for the external object. This field is available in API version 32.0 and later.

externalRepository

  • Field Type: string
  • Description: Available only for Salesforce Connect external objects. Corresponds to the Display URL Reference Field in the user interface. The external object’s Display URL standard field values are automatically generated from the external system. For example, with the OData 2.0 adapter for Salesforce Connect, the value is based on the link href that’s defined on the OData producer. You can override the default values with the values of a custom field on the same external object. Select the field name, and ensure the custom field’s values are valid URLs.

    This field is available in API version 32.0 and later.

externalSharingModel

  • Field Type: SharingModel (enumeration of type string)
  • Description:

    External org-wide defaults for the object, which determines the access level for external users.

    This field is available in API version 31.0 and later.

fields

  • Field Type: CustomField[]
  • Description: One or more field names in the object.

fieldSets

  • Field Type: FieldSet
  • Description: Field set that exists on the object.

fullName

  • Field Type: string
  • Description: Full name of the object. It must be specified when creating, updating, or deleting the object. See createMetadata() to see an example of this field specified for a call. This value can't be null.

gender

  • Field Type: Gender
  • Description: Gender of the noun that represents the object. This is used for languages where words need different treatment depending on their gender.

household

  • Field Type: boolean
  • Description: Support for relationship groups, a feature available only with Salesforce for Wealth Management.

historyRetentionPolicy

indexes

  • Field Type: Index[]
  • Description: Index for a custom big object.

label

  • Field Type: string
  • Description: Label that represents the object throughout the Salesforce user interface. We recommend that you make object labels unique across all standard, custom, and external objects in the org.

listViews

  • Field Type: ListView[]
  • Description: One or more list views associated with the object.

namedFilter

  • Field Type: NamedFilter[]
  • Description: Represents the metadata associated with a lookup filter. This metadata type is used to create, update, or delete lookup filter definitions. This component has been removed as of API version 30.0 and is only available in previous API versions. The metadata associated with a lookup filter is now represented by the lookupFilter field in the CustomField component. This field is available in API version 17.0 and later.

    This field has been removed as of API version 30.0 and is only available in prior versions. The metadata associated with a lookup filter is now represented by the lookupFilter field in the CustomField component.

nameField

  • Field Type: CustomField
  • Description: Required for custom objects. On external objects, the name field can instead be specified by setting isNameField to true in the CustomField component. The field that this object's name is stored in. Every custom object must have a name, usually a string or auto number.

    Identifier for the custom object record. This 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.

pluralLabel

  • Field Type: string
  • Description: Plural version of the label value. Custom objects require a plural version of the label to ensure object names are localizable.

profileSearchLayouts

  • Field Type: ProfileSearchLayouts
  • Description: Represents a user profile’s search results layouts for an object. With profile-specific layouts, each user profile can have a different search results layout for an object. Available in API version 47.0 and later.

publishBehavior

  • Field Type: PlatformEventPublishBehavior (enumeration of type string)
  • Description: This field applies only to platform events. Indicates when platform event messages are published in a Lightning Platform transaction. This field applies to event messages published through the Lightning Platform, such as Apex, Process Builder, and Flow Builder, but not through Salesforce APIs. If you don’t specify this field, the default value used is PublishImmediately.

    This field is available in API version 46.0 and later.

  • Possible values:
    • PublishAfterCommit���The event message is published only after a transaction commits successfully. If the transaction fails, the event message isn't published.
    • PublishImmediately—The event message is published when the publish call executes, regardless of whether the transaction succeeds.

recordTypes

  • Field Type: RecordType[]
  • Description: Array of one or more record types defined for this object.

recordTypeTrackFeedHistory

  • Field Type: boolean
  • Description: Indicates whether the record type is enabled for feed tracking (true) or not (false). To set this field to true, the enableFeeds field on the associated CustomObject must also be true. For more information, see Customize Chatter Feed Tracking. This field is available in API version 19.0 and later.

recordTypeTrackHistory

  • Field Type: boolean
  • Description: Indicates whether history tracking is enabled for this record type (true) or not (false). To set recordTypeTrackHistory to true, the enableHistory field on the associated custom object must also be true. This field is available in API version 19.0 and later.

searchLayouts

  • Field Type: SearchLayouts
  • Description: Search Layouts related list information for the object.

sharingModel

  • Field Type: SharingModel(enumeration of type string)
  • Description: Indicates the org-wide defaults for the object. Note: In API version 29.0 and earlier, this field is read only and can’t be set using the Metadata API; you must use the Salesforce user interface. In API version 30.0 and later, you can set this field for internal users using the API and the Salesforce user interface.

sharingReasons

  • Field Type: SharingReason[]
  • Description: Reasons why the object is being shared.

sharingRecalculations

  • Field Type: SharingRecalculation[]
  • Description: List of custom sharing recalculations associated with the object.

startsWith

  • Field Type: StartsWith (enumeration of type string)
  • Description: Indicates whether the noun starts with a vowel, consonant, or is a special character (true) or not (false). This is used for languages where words need different treatment depending on the first character. Valid values are listed in StartsWith.

validationRules

  • Field Type: ValidationRule[]
  • Description: Array of one or more validation rules on the object.

visibility

  • Field Type: SetupObjectVisibility (enumeration of type string)
  • Description: Visibility of the custom object, custom setting, or custom metadata type.

    This field is available in API version 34.0 and later. For custom settings, this field replaces the customSettingsVisibility field.

  • Default value: Public
  • Possible values:
    • 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 type only) It’s only accessible by the custom Apex code in the package. Use this value to secure secrets such as API access keys and security tokens. Available in API version 47.0 and later.

webLinks

  • Field Type: WebLink[]
  • Description: Array of one or more weblinks defined for the object.

MktDataModelAttributes

Represents the Data 360 data model object (DMO) attributes for a custom object. This is a Data 360 subtype of CustomObject.

creationType

  • Field Type: DefinitionCreationType enumeration
  • Description: Indicates how the object was added. In API version 62.0 and later,
  • Possible values:
    • 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, additional valid values are:

    • Auxiliary
    • Clean_Room
    • Deletion_Records

dataModelTaxonomy

  • Field Type: string
  • Description:

    Reference to the data model on which the object is based. For a standard Data 360 model, the value must be Reference when creationType is Standard, or View when creationType is Custom.

description

  • Field Type: string
  • Description: Description of the object. Maximum length is 521 characters. This field is available in API version 55.0 and later.

isEnabled

  • Field Type: boolean
  • Description: Indicates whether the DMO is enabled (true) or not (false).

isSegmentable

  • Field Type: boolean
  • Description: Indicates whether you can use the DMO as a target for segmentation (true) or not (false).

isUsedForMetrics

  • Field Type: boolean
  • Description: Indicates whether the DMO is used for metrics (true) or not (false). This field includes additional object attributes that aren't present in the DMO POJO. This field is available in API version 55.0 and later.

labelOverride

  • Field Type: string
  • Description: Custom label that overrides the object’s default display label in the data model. If unspecified, the default label is used. Maximum length is 255 characters. This field is available in API version 66.0 and later.

masterLabel

  • Field Type: string
  • Description: Master label for this component. Maximum length is 40 characters. This field is available in API version 66.0 and later.

objectCategory

  • Field Type: string
  • Description: Object category used for modeling. Valid values are Engagement, Profile, and Other.

referenceEntityGroup

  • Field Type: string
  • Description: Entity group of the object in the reference model. Applied to standard objects.

referenceEntityName

  • Field Type: string
  • Description: Name of the object in the reference model. Applies to standard objects.

referenceEntitySubjectArea

  • Field Type: string
  • Description: Subject area of the object in the reference model. Applies only to standard objects.

MktDataLakeAttributes

Represents the Data 360 data lake object (DLO) attributes for a custom object. This is a Data 360 subtype of CustomObject. Its components are available in API version 50.0 and later.

Special Access Rules

You need an org with a Data Cloud license to access this object.

MktDataLakeAttributes Fields

creationType

  • Field Type: DefinitionCreationType enumeration of type string
  • Description: How this object was added.
  • Possible values:
    • Activation_Audience
    • Bridge
    • Curated
    • Custom
    • Derived
    • Ml_Prediction
    • Segment_Membership
    • Standard
    • System

    In API version 62.0 and later, additional valid 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, additional valid values are:
    • Ad_Audience_Insights
    • Auxiliary
    • Clean_Room
    • Deletion_Records
    • Problem_Records

isEnabled

  • Field Type: boolean
  • Description: Indicates whether the landing object is enabled (true) or not (false).

objectCategory

  • Field Type: string
  • Description: Object category used for modeling. Valid values are Behavioral, Profile, and Other.

Declarative Metadata Additional Components

CustomObject definitions can include additional components defined in the custom object for declarative metadata. The following components are defined in the CustomObject:

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.

1<?xml version="1.0" encoding="UTF-8"?>
2<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
3    <actionOverrides>
4        <actionName>CancelEdit</actionName>
5        <type>Default</type>
6    </actionOverrides>
7    <actionOverrides>
8        <actionName>Delete</actionName>
9        <type>Default</type>
10    </actionOverrides>
11    <actionOverrides>
12        <actionName>Edit</actionName>
13        <type>Default</type>
14    </actionOverrides>
15    <actionOverrides>
16        <actionName>Follow</actionName>
17        <type>Default</type>
18    </actionOverrides>
19    <actionOverrides>
20        <actionName>List</actionName>
21        <type>Default</type>
22    </actionOverrides>
23    <actionOverrides>
24        <actionName>New</actionName>
25        <type>Default</type>
26    </actionOverrides>
27    <actionOverrides>
28        <actionName>SaveEdit</actionName>
29        <type>Default</type>
30    </actionOverrides>
31    <actionOverrides>
32        <actionName>Tab</actionName>
33        <type>Default</type>
34    </actionOverrides>
35    <actionOverrides>
36        <actionName>View</actionName>
37        <type>Default</type>
38    </actionOverrides>
39    <deploymentStatus>InDevelopment</deploymentStatus>
40    <description>Products</description>
41    <enableFeeds>false</enableFeeds>
42    <externalDataSource>OData</externalDataSource>
43    <externalIndexAvailable>false</externalIndexAvailable>
44    <externalName>Products</externalName>
45    <fields>
46        <fullName>DiscontinuedDate__c</fullName>
47        <description>DiscontinuedDate</description>
48        <externalDeveloperName>DiscontinuedDate</externalDeveloperName>
49        <externalId>false</externalId>
50        <isFilteringDisabled>false</isFilteringDisabled>
51        <isNameField>false</isNameField>
52        <isSortingDisabled>false</isSortingDisabled>
53        <label>DiscontinuedDate</label>
54        <required>false</required>
55        <type>DateTime</type>
56    </fields>
57    <fields>
58        <fullName>ID__c</fullName>
59        <description>ID</description>
60        <externalDeveloperName>ID</externalDeveloperName>
61        <externalId>false</externalId>
62        <isFilteringDisabled>false</isFilteringDisabled>
63        <isNameField>false</isNameField>
64        <isSortingDisabled>false</isSortingDisabled>
65        <label>ID</label>
66        <precision>18</precision>
67        <required>false</required>
68        <scale>0</scale>
69        <type>Number</type>
70        <unique>false</unique>
71    </fields>
72    <fields>
73        <fullName>Name__c</fullName>
74        <description>Name</description>
75        <externalDeveloperName>Name</externalDeveloperName>
76        <externalId>false</externalId>
77        <isFilteringDisabled>false</isFilteringDisabled>
78        <isNameField>false</isNameField>
79        <isSortingDisabled>false</isSortingDisabled>
80        <label>Name</label>
81        <length>128</length>
82        <required>false</required>
83        <type>Text</type>
84        <unique>false</unique>
85    </fields>
86    <fields>
87        <fullName>Price__c</fullName>
88        <description>Price</description>
89        <externalDeveloperName>Price</externalDeveloperName>
90        <externalId>false</externalId>
91        <isFilteringDisabled>false</isFilteringDisabled>
92        <isNameField>false</isNameField>
93        <isSortingDisabled>false</isSortingDisabled>
94        <label>Price</label>
95        <precision>16</precision>
96        <required>false</required>
97        <scale>2</scale>
98        <type>Number</type>
99        <unique>false</unique>
100    </fields>
101    <fields>
102        <fullName>Products__c</fullName>
103        <externalDeveloperName>Products</externalDeveloperName>
104        <externalId>false</externalId>
105        <isFilteringDisabled>false</isFilteringDisabled>
106        <isNameField>false</isNameField>
107        <isSortingDisabled>false</isSortingDisabled>
108        <label>Products</label>
109        <length>20</length>
110        <referenceTo>Products__x</referenceTo>
111        <relationshipLabel>Products</relationshipLabel>
112        <relationshipName>Products</relationshipName>
113        <type>ExternalLookup</type>
114    </fields>
115    <fields>
116        <fullName>Rating__c</fullName>
117        <description>Rating</description>
118        <externalDeveloperName>Rating</externalDeveloperName>
119        <externalId>false</externalId>
120        <isFilteringDisabled>false</isFilteringDisabled>
121        <isNameField>false</isNameField>
122        <isSortingDisabled>false</isSortingDisabled>
123        <label>Rating</label>
124        <precision>18</precision>
125        <required>false</required>
126        <scale>0</scale>
127        <type>Number</type>
128        <unique>false</unique>
129    </fields>
130    <fields>
131        <fullName>ReleaseDate__c</fullName>
132        <description>ReleaseDate</description>
133        <externalDeveloperName>ReleaseDate</externalDeveloperName>
134        <externalId>false</externalId>
135        <isFilteringDisabled>false</isFilteringDisabled>
136        <isNameField>false</isNameField>
137        <isSortingDisabled>false</isSortingDisabled>
138        <label>ReleaseDate</label>
139        <required>false</required>
140        <type>DateTime</type>
141    </fields>
142    <label>Products</label>
143    <pluralLabel>Products</pluralLabel>
144    <searchLayouts>
145        <customTabListAdditionalFields>ExternalId</customTabListAdditionalFields>
146        <lookupDialogsAdditionalFields>ExternalId</lookupDialogsAdditionalFields>
147        <lookupPhoneDialogsAdditionalFields>ExternalId</lookupPhoneDialogsAdditionalFields>
148        <searchResultsAdditionalFields>ExternalId</searchResultsAdditionalFields>
149        <searchResultsAdditionalFields>DisplayUrl</searchResultsAdditionalFields>
150        <searchResultsAdditionalFields>ID__c</searchResultsAdditionalFields>
151    </searchLayouts>
152</CustomObject>

Wildcard Support in the Manifest File

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.