Newer Version Available
CustomObject
Represents a custom object that stores data unique to your organization or an external object that maps to data stored outside Salesforce. This type extends the Metadata metadata type and inherits its fullName field. You must specify all relevant fields when you create or update a custom object. You cannot update a single field on the object. For more information about custom objects, see “Custom Object Record Overview” in the Salesforce online help.
You can also use this metadata type to work with customizations of standard objects, such as accounts. For an example, see Standard Objects.
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__cAnd the following is a fully specified name for an external object:
1MyExternalObject__xFor 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.
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 createable, filterable, and nillable.
| Field Name | Field Type | Description |
|---|---|---|
| actionOverrides | ActionOverride[] |
A list of action overrides on
the object. This field is available in API version 18.0 and later. |
| allowInChatterGroups | boolean |
Indicates whether
records of this custom object type can be added to Chatter
groups. This field is availabe in API version 34.0 and later. |
| businessProcesses | BusinessProcess[] |
A list of business
processes associated with the object. This field is available in API version 17.0 and later. |
| compactLayoutAssignment | string |
The compact
layout assigned to the object. This field is available in API version 29.0 and later. |
| compactLayouts | CompactLayout[] |
A list of compact layouts
associated with the object. This field is available in API version 29.0 and later. |
| customHelp | string | The 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 | string | The 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 | CustomSettingsType (enumeration of type string) |
When this field is present, this
component is not a custom object, but a custom setting. This
field returns the type of custom setting. The following
string values are valid:
This field is available in API version 17.0 and later. |
| customSettingsVisibility | CustomSettingsVisibility (enumeration of type string) |
When this field is
present, this component is not a custom object, but a custom
setting. This field returns the visibility of the custom
setting. The following string values are valid:
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. |
| deploymentStatus | DeploymentStatus (enumeration of type string) | Indicates the deployment status of the object. |
| deprecated | boolean | Reserved for future use. |
| description | string | A description of the object. Maximum of 1000 characters. |
| enableActivities | boolean | Indicates whether the object is enabled for activities (true) or not (false). |
| enableBulkApi | boolean |
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 | boolean | Indicates whether the object is enabled for divisions (true) or not (false). For more information about the Division object, see the SOAP API Developer's Guide. |
| enableEnhancedLookup | boolean | Indicates whether the object is enabled for enhanced lookups (true) or not (false). 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 gives users the ability to filter, sort, and page through search results as well as customize search result columns. For more information about enhanced lookups, see “Enabling Enhanced Lookups” in the Salesforce online help. |
| enableFeeds | boolean |
Indicates whether the object is enabled
for feed tracking (true) or
not (false). For more
information, see “Customize Chatter
Feed Tracking” in the Salesforce online help.
This field is available in API version 18.0 and later. |
| enableHistory | boolean | 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. |
| enableReports | boolean | Indicates whether the object is enabled for reports (true) or not (false). |
| enableSearch | boolean | Indicates whether the object can be searched via the data APIs
(true) or not (false).
This field is available in API version 35.0 and later. |
| enableSharing | boolean |
When enabled, the object is classified
as an Enterprise Application object for usage
tracking. When enabled, enableBulkApi and enableStreamingApi must also be enabled. This field is available in API version 31.0 and later. |
| enableStreamingApi | boolean |
When enabled, the object is classified
as an Enterprise Application object for usage
tracking. When enabled, enableBulkApi and enableSharing must also be enabled. This field is available in API version 31.0 and later. |
| externalDataSource | string |
Required and available for
external objects only. 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 | string |
Required and available for
external objects only. 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 | string | Available for Lightning Connect external objects only. Corresponds to 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 Lightning 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 make sure that the custom field’s values are valid URLs. This field is available in API version 32.0 and later. |
| externalSharingModel | SharingModel(enumeration of type string) |
Indicates the external organization-wide
defaults for the object, which determines the access level for
external users, such as portal and community users. This field
is supported for these objects:
This field is available in API version 31.0 and later. |
| fields | CustomField[] | Represents one or more fields in the object. |
| fieldSets | FieldSet | Defines the field set that exists on this object. |
| fullName | string |
Inherited from Metadata,
this field is not defined in the WSDL for this metadata type. It
must be specified when creating, updating, or deleting. See
create() to see an example of this field specified for a
call. This value cannot be null. |
| gender | Gender | Indicates the gender of the noun that represents the object. This is used for languages where words need different treatment depending on their gender. |
| household | boolean | This field supports relationship groups, a feature available only with Salesforce for Wealth Management. For more information, see “Salesforce for Wealth Management Overview” in the Salesforce online help. |
| historyRetentionPolicy | HistoryRetentionPolicy | Reserved for future use. |
| label | string | Label that represents the object throughout the Salesforce user interface. |
| listViews | ListView[] | Represents one or more list views associated with the object. |
| namedFilter | NamedFilter[] |
Represents the metadata associated with a lookup
filter. Use this metadata type to create, update, or delete lookup
filter definitions. 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 | CustomField | Required for custom objects. External objects may instead specify
the name field 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 autonumber. 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 | string | Plural version of the label value. |
| recordTypes | RecordType[] | An array of one or more record types defined for this object. |
| recordTypeTrackFeedHistory | boolean |
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” in the Salesforce
online help. This field is available in API version 19.0 and later. |
| recordTypeTrackHistory | boolean |
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 | SearchLayouts | The Search Layouts related list information for the object. |
| sharingModel | SharingModel(enumeration of type string) | Indicates the organization-wide defaults for the object. |
| sharingReasons | SharingReason[] | The reasons why the object is being shared. |
| sharingRecalculations | SharingRecalculation[] | A list of custom sharing recalculations associated with the object. |
| startsWith | StartsWith (enumeration of type string) | Indicates whether the noun starts with a vowel, consonant, or is a special character. This is used for languages where words need different treatment depending on the first character. Valid values are listed in StartsWith. |
| validationRules | ValidationRule[] | An array of one or more validation rules on the object. |
| visibility | SetupObjectVisibility (enumeration of type string) | When this field is present, this component is not a custom
object, but a custom setting or custom metadata type. This field
returns the visibility of the custom setting or custom metadata
type. The following values are valid.
The default value is Public. This field is available in API version 34.0 and later. For custom settings, this field replaces the customSettingsVisibility field. |
| webLinks | WebLink[] | An array of one or more weblinks defined for the object. |
Declarative Metadata Additional Components
CustomObject definitions may include additional components which are 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 Lightning 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>