CustomObject defines an object's schema and object-level configuration, not its business records. It represents custom objects that store Salesforce data, external objects that map to external data, and supported customizations of standard objects such as Account. It also carries definitions for custom settings, custom metadata types, platform events, custom big objects, and Data 360 objects. An element's applicability depends on the kind of object.
The component contains fields, record types, validation rules, business processes, compact layouts, search layouts, action overrides, and other object configuration. Some children can be addressed separately through Metadata API. ActionOverride and SearchLayouts, however, are accessible only through their encompassing CustomObject.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The object's metadata identity, required for create, update, and delete operations. Examples: Account, MyCustomObject__c, and MyExternalObject__x. |
label, pluralLabel
|
The singular and plural object labels. Custom objects require pluralLabel. These labels are separate from the label of the record's Name field. |
nameField |
The record's display identifier, usually Text or AutoNumber. Required for custom objects; it is not the object's metadata identity. |
deploymentStatus |
The object's deployment status: Deployed or InDevelopment. This is separate from sharing, licensing, and package visibility. |
sharingModel, externalSharingModel
|
Organization-wide record-access defaults for internal and external users, respectively. Relationship design affects which sharing configuration is appropriate. |
visibility |
Packaged component visibility: Public, Protected, or, for custom metadata types only, PackageProtected. The default is Public; this setting is not record sharing. |
enableLicensing |
When true, users require a permission set license for the object. |
enableBulkApi, enableSharing, enableStreamingApi
|
A coupled configuration: enabling any one requires the other two. Salesforce classifies the object as an Enterprise Application object for usage tracking. |
fields |
Contained CustomField definitions, including relationships, formulas, picklists, tracking, and field-governance information. |
recordTypes, businessProcesses
|
Record-type choices, business-process assignments, and picklist subsets. Nested process references use bare process names. |
enableHistory, enableFeeds
|
Object-level prerequisites for field and record-type history or feed tracking. They do not identify every tracked field. |
enableSearch, enableEnhancedLookup
|
Search discovery and enhanced lookup behavior. Set enableSearch=true before enabling enhanced lookups. |
searchLayouts, profileSearchLayouts
|
Search-result fields, lookup fields, buttons, and profile-specific result layouts. Profile-specific layouts have destination-profile and custom-object-tab prerequisites. |
actionOverrides |
Replacements for standard actions. Nested type values include Default, Standard, Flexipage, LightningComponent, and Visualforce. |
publishBehavior |
For platform events, selects PublishAfterCommit or PublishImmediately for publication through the Lightning Platform. The default is PublishImmediately. |
Behavior and Constraints
Availability, permissions, and sharing
Deployment status, record sharing, licensing, and package visibility describe different controls. visibility=Public exposes a packaged component to subscribing orgs. Protected restricts a managed-package component to the developer org. PackageProtected applies only to custom metadata types and limits access to custom Apex in the package. None of these settings replaces object permissions or record-sharing configuration.
sharingReasons defines reasons for Apex managed sharing, which lets Apex code share custom-object records. That sharing survives record-owner changes or deactivation. Adding or changing it requires Modify All Data. In sharingRecalculations, the class named by className must implement Database.Batchable.
Relationship fields and data integrity
The following elements belong to contained CustomField definitions, not to the top-level object:
-
referenceToidentifies the related object. The field's relationship type and settings determine ownership, deletion, and access behavior. - For lookup relationships,
deleteConstraintacceptsCascade,Restrict, orSetNull. The default,SetNull, clears the lookup when the referenced record is deleted.Restrictprevents deletion while the relationship exists. These settings concern record deletion, not metadata-component deletion. - For a junction object, which connects two masters through master-detail relationships,
relationshipOrder=0identifies the primary relationship and1identifies the secondary relationship. This distinction affects deletion behavior, ownership, and inherited look and feel. -
reparentableMasterDetailcontrols whether detail records can move to another master. Its default isfalse. -
writeRequiresMasterRead=truepermits creating, editing, or deleting detail records with Read access to the parent. The default,false, requires Read/Write access. - For roll-up summaries,
summarizedFieldidentifies the detail field being summarized, whilesummaryForeignKeyidentifies the detail object's master-detail field. They are different references.
Picklists, validation rules, and record types
A picklist uses either an inline valueSetDefinition or a valueSetName reference to a GlobalValueSet. A field with only valueSetName does not have an empty picklist. Its values are maintained in the global value set. Such picklists are restricted, and adding or removing values requires changing that global value set. Dependent picklists use controllingField and valueSettings; record types can expose subsets of the available values.
Within validationRules, active determines whether a rule applies. errorConditionFormula evaluates to true for invalid data. errorDisplayField places the error beside a field; if omitted, or if that field is not visible on the page layout, the error appears at the top of the page. Field formulas and validation formulas can embed references to CustomField and CustomLabel components.
Record types connect business processes, picklist choices, and user-facing layouts. Within recordTypes, businessProcess is required for Lead, Opportunity, Solution, and Case and is not allowed for other objects. Use the bare process name in that element and in nested businessProcesses.fullName. Separately addressed BusinessProcess components use ObjectName.ProcessName.
Record types and business processes are not read-access boundaries. Profile assignments govern creation and editing choices, not whether users can read otherwise accessible records or configuration. Their names, labels, descriptions, and process picklist values are not protected storage for sensitive information.
Field governance
These governance elements belong to contained fields and are present when an administrator has set them:
-
businessStatusrecords intended usage:Active,DeprecateCandidate, orHidden. It is not observed usage telemetry, andHiddendoes not itself block access. -
securityClassificationrecords sensitivity:Public,Internal,Confidential,Restricted, orMissionCritical. -
complianceGroupstores semicolon-separated categories fromCCPA,COPPA,GDPR,HIPAA,PCI, andPII. -
descriptiondocuments the field's purpose, whileinlineHelpTextsupplies guidance shown to users. Neither is itself a sensitivity classification. -
businessOwnerGroupandbusinessOwnerUseridentify responsibility for understanding the field's importance and determining its minimum security classification. They do not grant data access.
Sensitivity and compliance classifications do not enforce permissions or demonstrate regulatory compliance. Missing governance values do not establish that a field is unused or contains harmless data.
Tracking and retention
A field's trackHistory=true requires enableHistory=true on the object. Similarly, trackFeedHistory=true requires enableFeeds=true. The object-level recordTypeTrackHistory and recordTypeTrackFeedHistory flags require their corresponding object-level tracking flags. Account history tracking includes person-account history. Field history tracking is unavailable for external objects.
Historical trending is separate from field history tracking. At least one field with trackTrending=true enables the object for historical trending.
The object-level archiving policy described by HistoryRetentionPolicy requires RetainFieldHistory. Under that documented behavior, archiveAfterMonths accepts 1 through 18 months and defaults to 18. archiveRetentionYears is a reminder for manual deletion, not an automatic deletion timer. Field Audit Trail does not automatically delete history by default. The documentation conflict concerning this policy is described below.
Search and user interaction
enableSearch controls discovery through SOSL, Salesforce's search query language, and Salesforce searches. Search is disabled by default for new custom and external objects. Salesforce also documents disabling searchability for custom objects that have not been searched for more than 120 days. For external objects created or updated by external-data-source synchronization, search enablement follows the data source's search setting.
Search layouts do not make an object searchable. enableEnhancedLookup requires enableSearch=true first. profileSearchLayouts supplies profile-specific search results, with searchLayouts providing the fallback.
In actionOverrides, content identifies the replacement implementation. Installed components use Component_namespace__Component_name. Default uses an installed package's override when one exists, otherwise standard Salesforce behavior. Standard explicitly selects regular Salesforce behavior. Consequently, managed-package overrides can retrieve as Default without naming their implementation.
An override's formFactor=Large represents Lightning Experience desktop, Small represents the mobile app, and an omitted value represents Salesforce Classic. Flexipage is valid only for the View action in Lightning Experience and requires Large. skipRecordTypeSelect is valid only for a create-type action using Visualforce.
compactLayoutAssignment selects the object's compact layout; record types can have their own assignments. Field sets provide administrator-maintained field groupings for consumers such as Visualforce pages. Their displayedFields order is presentation order. Search-layout massQuickActions references quick actions, while custom-button lists reference web links.
Specialized object definitions
Custom settings: The presence of customSettingsType identifies a custom setting rather than an ordinary custom object. List stores org-wide cached configuration data. Hierarchy, the default, resolves cached configuration by user, profile, or org.
External objects: externalDataSource and externalName are required. They identify the ExternalDataSource component and external table. Contained fields use externalDeveloperName to map external columns. One Text field can serve as the name field through isNameField=true.
External objects do not support enableActivities or field history tracking. They also do not support formulas, master-detail relationships, roll-up summaries, Location, encrypted text, or rich text. AutoNumber, Currency, Picklist, and MultiselectPicklist are available only with the Salesforce Connect cross-org adapter.
For an indirect lookup, referenceTargetField must identify a parent custom field with both externalId=true and unique=true; caseSensitive affects matching. externalRepository identifies a field on the same external object whose valid URL values override the generated Display URL.
Platform events: eventType=HighVolume identifies a high-volume platform event. publishBehavior=PublishAfterCommit publishes only after a successful transaction commit; a failed transaction does not publish the message. PublishImmediately publishes when the call executes regardless of transaction success and is the default when unspecified. This setting applies to publication through the Lightning Platform, including Apex and Flow, not publication through Salesforce APIs.
Custom big objects: indexes defines the composite primary key. Each index field's name must match a contained field's fullName, and that field must be required. Field order and sortDirection, which accepts ASC or DESC, define the index structure. When SOQL query results are passed to the delete API, leading or trailing whitespace in an index field name prevents deletion of the big-object record.
Data 360 objects: mktDataLakeAttributes describes ingestion or landing objects and requires an org with a Data Cloud license. Its objectCategory values are Profile, Behavioral, and Other. mktDataModelAttributes describes data model objects, whose categories are Profile, Engagement, and Other. For data model objects, isEnabled controls enablement, while isSegmentable controls eligibility as a segmentation target. dataModelTaxonomy must be Reference for creationType=Standard and View for creationType=Custom.
Data 360 field retrieval returns only properties supported by the field's data type. Deployment rejects unsupported properties. A property exposed by the shared CustomField schema is therefore not necessarily legal on a data lake object or data model object.
Deployment and Retrieval
Component files and update scope
In Metadata API format, custom, standard, and external object definitions use the .object suffix in the objects folder. Ordinary custom-object names end in __c; external-object names end in __x.
Create and update operations require all relevant object properties, rather than a one-property patch. Individual fields can still be addressed separately as CustomField components using ObjectName.FieldName, such as Account.MyField__c.
What retrieval includes and omits
Retrieving an object returns its contained configuration, not merely an object header. It does not return every runtime field: noncustomizable standard fields, including system fields such as CreatedById, are outside CustomField support. User-private list views marked Visible only to me are inaccessible through Metadata API.
Retrieving a RecordType does not retrieve its picklist field definitions. Person-account record types also omit custom picklist values originating on Contact.
Retrieving CustomObject or CustomField components affects the corresponding entries included in Profile and PermissionSet components retrieved in the same package. Permission metadata must therefore be interpreted in the context of the retrieval scope.
Picklist and search-layout deployment effects
Omitting picklist values from a deployed component definition deactivates them. This applies to standard and custom field picklist values. It does not mean that every omitted object child is deleted. Retrieval also differs by picklist kind: global value sets return active and inactive values, whereas non-global unrestricted picklists return only active values.
Deploying a profile-specific search layout requires the profile to exist in the destination. For a custom object, search must be enabled, and the object's tab must already exist or be included in the deployment.
Search-layout retrieval and deployment treat the Name column asymmetrically. A text Name field is mandatory, appears first, and is omitted from returned additional-field lists. An AutoNumber Name can be removed in the UI, but Metadata API import adds it back. These rules apply to customTabListAdditionalFields, lookupDialogsAdditionalFields, lookupPhoneDialogsAdditionalFields, and searchResultsAdditionalFields.
Removing overrides and associated configuration
Action overrides cannot be removed through a destructive metadata deployment. Reset an override through its object definition:
- Retrieve the current
CustomObjectdefinition. - Remove
contentfrom each override being reset. - Set that override's
typetoDefault. - Deploy the modified object.
This restores default behavior, which can still be a package override. It does not have the same meaning as Standard. Org-default Flexipage override assignments cannot be retrieved from a managed package.
Creating or deleting a custom object can automatically create or remove some associated configuration, depending on component type and enabled features. Deleting a custom object also removes its object translations. Object creation does not establish that every source translation or other associated component is recreated. Naming associations alone establish neither containment nor mandatory co-deployment; deployment scope depends on actual references and destination state.
Relationships
Object dependencies are distributed across nested fields, formulas, layouts, list views, record types, and overrides. The references below describe possible connections, not proof that a particular component uses an object. Apex, Visualforce, Lightning code, and email templates can embed object references in their content rather than in a dedicated object-name element. Name-based associations are listed separately from element references.
References
-
ApexClass:className. -
ApexPage:content,customHelpPage,page. -
BusinessProcess:businessProcess. -
CompactLayout:compactLayoutAssignment. -
CustomField:columns,controllingField,customTabListAdditionalFields,errorConditionFormula,errorDisplayField,externalRepository,field,fields,formula,lookupDialogsAdditionalFields,lookupFilterFields,lookupPhoneDialogsAdditionalFields,metadataRelationshipControllingField,name,picklist,referenceTargetField,searchFilterFields,searchResultsAdditionalFields,summarizedField,summaryForeignKey,valueField. -
CustomLabel:errorConditionFormula,formula. -
CustomObject:columns,referenceTo. -
ExternalDataSource:externalDataSource. -
FlexiPage:content. -
GlobalValueSet:valueSetName. -
Group:businessOwnerGroup,group. -
LightningBundle:content. -
Profile:profileName. -
Queue:queue. -
QuickAction:massQuickActions. -
Role:role,roleAndSubordinates,roleAndSubordinatesInternal. -
Scontrol:content,customHelp,scontrol. -
StandardValueSet:picklist. -
TerritoryModel:territory,territoryAndSubordinates. Territory values usemodelName.territoryName. -
WebLink:listViewButtons,searchResultsCustomButtons.
Referenced By
AccountPlanObjMeasCalcDef, AccountRelationshipShareRule, ActionableListDefinition, ActionPlanTemplate, AdvAccountForecastSet, AIUsecaseDefinition, AnalyticSnapshot, AnimationRule, ApexClass, ApexComponent, ApexPage, ApexTrigger, AssignmentRules, AssignmentRule, Audience, LightningBundle, BatchCalcJobDefinition, BatchProcessJobDefinition, Bot, BotVersion, BotBlock, BotTemplate, BriefcaseDefinition, CareProviderSearchConfig, CareRequestConfiguration, CareSystemFieldMapping, CleanDataService, ConversationMessageDefinition, ConversationVendorInfo, CustomApplication, CustomFeedFilter, CustomObject, CustomField, ListView, DataCategoryGroup, DataObjectSearchIndexConf, DataStreamDefinition, DecisionTable, DecisionTableDatasetLink, DelegateGroup, DiscoveryGoal, DuplicateRule, EmailTemplate, EntitlementProcess, ExpressionSetDefinition, ExpressionSetObjectAlias, ExternalDataSource, FieldRestrictionRule, FieldSrcTrgtRelationship, FlexiPage, Flow, FlowTest, ForecastingSourceDefinition, GenAiPromptTemplate, IdentityVerificationProcDef, LightningWebComponent, MarketSegmentDefinition, MLDataDefinition, ModerationRule, MutingPermissionSet, NavigationMenu, ObjectSourceTargetMap, OrchestrationPlanCtxMapping, Layout, ParticipantRole, PathAssistant, PermissionSet, PlatformEventChannelMember, Queue, QuickAction, RecommendationStrategy, RecordActionDeployment, RelatedRecordAssocCriteria, Report, ReportType, RestrictionRule, SalesWorkQueueSettings, SearchCustomization, SearchOrgWideObjectConfig, ServiceAISetupField, ServiceChannel, SharingSet, SvcCatalogFulfillmentFlow, TerritoryModel, TimelineObjectDefinition, TopicsForObjects, UiFormatSpecificationSet, UIObjectRelationConfig, Workflow, WorkflowFieldUpdate, WorkSkillRouting.
Name-Based Associations
Apply these rules to the full component file base after removing its directory and metadata extension. Preserve namespaces before interpreting the name.
-
AssignmentRules,AutoResponseRules,EscalationRules,MatchingRules,SharingRules,TopicsForObjects, andWorkflowuse the entire file base as the associated object name. -
CustomTabuses that same rule only whencustomObject=true. Other tab kinds are not object-associated merely because their names match. -
ApprovalProcess,CustomFeedFilter,DuplicateRule, andPostTemplateuse<objectName>.<componentName>; the object name precedes the first period. -
Layoutuses<objectName>-<layoutName>; the object name precedes the first dash, and the remainder is the layout name. -
CustomObjectTranslationuses<objectName>-<languageCode>; the object name precedes the first dash, and the remaining suffix identifies the language.
Documentation Inconsistencies
- The
CustomObjectfield table labelshistoryRetentionPolicyas reserved, while the dedicated HistoryRetentionPolicy documentation describes an operational object-level archiving policy requiringRetainFieldHistory. The retention behavior described above follows the dedicated definition. - The exposed action-override enum uses spellings such as
Default,Standard,Flexipage,LightningComponent, andVisualforce. The ActionOverride descriptions and examples also use lowercase spellings and are inconsistent about capitalization.
Reported Issues
- Missing runtime fields may reflect access rather than missing metadata. An August 2023 report found more fields through Metadata API read than through runtime describe. The response attributed the difference to field permissions and, where relevant, package licensing and access to lookup targets. This is a reported explanation, not a diagnosis of every missing field. Read versus describe discussion.
-
A "no CustomObject named ..." error can concern an unavailable standard object. For an
AccountContactRelationscratch-org failure, July 2022 guidance usedaccountSettings.enableRelateContactToMultipleAccounts. The reported issue was standard-object availability, not the need to create a replacement custom object. AccountContactRelation configuration discussion. - Independent sharing requirements can conflict with a master-detail design. A November 2022 report with Contact as master and a custom object as detail described no detail Share object and no independent Apex managed sharing or sharing rules for the detail records. Detail-record sharing discussion.
-
A deployment can report a missing master-detail relationship even when the source object has one. In a 2014 report, including the unchanged master-detail field with the object resolved a
ControlledByParentsharing-model error. A follow-up reported the same distinction for change sets containing the object but not its fields. Master-detail deployment discussion. -
A missing-component deployment error can come from ZIP structure. In a 2015 report, deploying a ZIP containing an enclosing
unpackageddirectory produced missing-object errors or a deployment with zero components. An answer recommended placingpackage.xmland the component folders at the ZIP root withsinglePackage=true. Deployment ZIP discussion. -
A named value set is not a missing list of picklist options. In an August 2023 report, fields returned
valueSetNamewithout an inlinevalueSetDefinition. The accepted response identified a global value set and recommended reading the namedGlobalValueSetseparately. Global picklist retrieval discussion.
Common Questions
Why does retrieving CustomObject also retrieve validation rules and list views?
CustomObject is a container for object configuration, not just an object header. A retrieval includes contained configuration. To retrieve specific fields instead, address CustomField members as ObjectName.FieldName. Noncustomizable system fields and user-private list views remain outside the supported retrieval scope.
Why does a picklist return valueSetName instead of its values?
The field references a GlobalValueSet. Read that component to obtain its values; the missing inline definition does not mean the picklist is empty. Adding or removing values requires changing the global value set.
Why does deploying a profile-specific search layout fail?
The named profile must exist in the destination. For a custom object, search must be enabled and the object tab must already exist or be included in the deployment. Configuring search-layout fields alone does not enable search.
How do I remove a CustomObject action override?
Retrieve the current object, remove the relevant override's content, set its type to Default, and deploy the modified definition. A destructive metadata deployment cannot remove the override. Default can still select a package override; Standard explicitly selects regular Salesforce behavior.
Does archiveRetentionYears automatically delete archived field history?
No. It records a reminder for manual deletion. Under the documented retention-policy behavior, archiveAfterMonths controls when history is archived, while Field Audit Trail does not automatically delete history by default.