MarketSegmentDefinition stores the exportable definition of a market segment, including its criteria and other attributes. It represents a portable definition, not proof that a segment has been instantiated or is running. Developers can package data build tool (DBT) segment definitions and publish them on AppExchange for subscriber organizations to install and instantiate.
Only DBT is documented as supported through the API. The presence of other segment types in the enumeration, and the UI-specific rules for some fields, do not establish API creation support for those types.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The metadata component's identity, inherited from Metadata. It is distinct from the display label. |
masterLabel |
Required. Supplies the display name of the market segment definition. |
segmentType |
Required. Selects the segment type. Only DBT is documented as supported through the API; the broader enumeration does not establish support for creating other types. |
includeCriteria |
Contains the DBT definition as XML wrapped in a CDATA section, which preserves the enclosed XML as text. Only a single DBT model is supported. |
excludeCriteria |
Contains JSON exclusion criteria for UI-based segments. It does not apply to DBT or Lookalike segments. |
additionalMetadata |
Contains XML name-value pairs for additional metadata, stored as a string. It does not apply to DBT segments. |
segmentOn |
Required when segmentType is UI. Must contain a valid developerName of a Profile-type MktDataModelObject instance, not a record ID. |
Behavior and Constraints
For a DBT segment, put the DBT definition in includeCriteria and wrap that XML in a CDATA section. The supported definition contains only one DBT model. The documented example uses a DbtPipeline containing models, a single model, and that model's name and sql.
Do not treat excludeCriteria or additionalMetadata as additional DBT configuration. Neither field applies to DBT segments. In particular, excludeCriteria describes JSON exclusion criteria for UI-based segments, rather than a second DBT model or a DBT exclusion block.
The conditional requirement for segmentOn applies when segmentType is UI. Its value identifies a Profile-type MktDataModelObject by developer name. That rule does not expand the documented API support beyond DBT.
A definition's existence, including a reference to it from a Flow, does not establish that the segment has been instantiated. A Flow reference also does not establish that the consuming flow is active.
Deployment and Retrieval
Components use the .marketSegmentDefinition file suffix and reside in the marketSegmentDefinitions directory. The inherited fullName identifies the component; the required masterLabel is its display name.
Use MarketSegmentDefinition as the type name in package.xml, the metadata manifest. The documented manifest example selects this type with * as the member selector. See Deploying and Retrieving Metadata with the Zip File for manifest and file-based deployment mechanics.
DBT segment definitions can be distributed through AppExchange packages so subscriber organizations can install and instantiate the segments. Keep the portable definition separate from the instantiated segment when assessing what a package or retrieved metadata component represents.
Relationships
segmentOn has a documented semantic target of a Profile-type MktDataModelObject instance, while dependency tracking recognizes it as an outgoing reference to CustomObject. A Flow can reference the definition through its own segment element. These connections describe possible dependencies, not proof of actual use or a required deployment sequence.
References
-
CustomObject:segmentOn.
Referenced By
-
Flow:segment.
Documentation Inconsistencies
The exposed schema and the API field documentation differ in the segmentType enumeration. The schema uses EinsteinGptSegmentsUI, while the API documentation lists EinsteinGPTSegmentsUI. The schema also exposes Realtime and Waterfall, which are absent from the documented list. Both lists also contain DBT, Dynamic, Lookalike, and UI.
These enumeration differences do not change the documented API support restriction: only DBT is supported through the API. Do not interpret an exposed enumeration value as confirmation that the API can create that segment type.
Common Questions
Can I create a UI segment through the MarketSegmentDefinition API?
Only DBT is documented as supported through the API. The UI enumeration value and its conditional segmentOn requirement do not establish API creation support for UI segments.
How do I include a DBT definition in MarketSegmentDefinition?
Set segmentType to DBT and place the DBT XML in includeCriteria, wrapped in a CDATA section. Only one DBT model is supported. Neither excludeCriteria nor additionalMetadata applies to DBT segments.
Does segmentOn take a record ID or a developer name?
For a UI segment, segmentOn requires a valid developerName of a Profile-type MktDataModelObject instance, not a record ID.
Where are MarketSegmentDefinition files stored?
They are stored in the marketSegmentDefinitions directory with the .marketSegmentDefinition suffix. The manifest type name is MarketSegmentDefinition.
Does a Flow reference mean the segment is running?
No. A Flow's segment element can reference a MarketSegmentDefinition, but that reference does not establish that the flow is active or that the segment has been instantiated or is running.