Analytics Data Preparation (XMD Metadata and External Augmentation)
Use this skill when applying field-level metadata customizations to CRM Analytics datasets using the XMD REST API to set labels, aliases, date formats, number formats, and measure/dimension classification at the org level. Also covers the external data augmentation pattern for incorporating non-Salesforce data into CRM Analytics recipes.
Before Starting
Gather this context before working on anything in this domain:
- What is the dataset ID (not API name — find via
GET /wave/datasets or the Analytics Studio URL)?
- Is the change org-wide (PATCH main XMD) or personal preference (PATCH user XMD)?
- Are there external CSV files or Salesforce Files to be loaded as a recipe lookup source?
- Is this a one-time metadata update or part of a deployment pipeline requiring automated XMD updates post-dataflow?
Core Concepts
XMD Layer Hierarchy
CRM Analytics uses a three-layer Extended Metadata (XMD) system:
- System XMD (
type=system): Platform-generated. Immutable. Contains raw field API names and inferred data types. Cannot be modified — PATCH returns HTTP 400.
- Main XMD (
type=main): Org-customizable. PATCH this layer to apply field label, format, and classification changes for all users.
- User XMD (
type=user): Per-user customizations. Overrides main XMD only for the user who created the customization.
Resolution order at render time: user XMD → main XMD → system XMD (first non-null value wins).
XMD REST API Mechanics
GET /services/data/v{version}/wave/datasets/{datasetId}/xmds/{xmdtype}
PATCH /services/data/v{version}/wave/datasets/{datasetId}/xmds/{xmdtype}
Key behaviors:
- PATCH is an additive merge — include only properties you want to change.
- System XMD PATCH returns HTTP 400.
- WaveXmd is NOT queryable via SOQL — the REST API is the only interface. SOQL throws INVALID_TYPE.
- Main XMD has no version history — PATCH is destructive. Always GET and save a backup before modifying.
External Data Augmentation Pattern
CRM Analytics recipes support loading external data via:
- Files node (CSV): Upload a CSV to Salesforce Files (ContentDocument), then reference it in a Recipe Files node. Best for reference data such as product hierarchies, territory mappings, or cost tables that do not exist in Salesforce objects.
- Augment node: Join the Files node dataset to a primary dataset inside the recipe. The Augment node performs a left outer join keyed on a shared field.
External CSV data loaded via Files node is NOT subject to automatic incremental sync — it must be manually re-uploaded or replaced via Salesforce Files API to refresh the data.
Common Patterns
Pattern: PATCH Main XMD for Field Label Updates
When to use: After dataflow or recipe deployment when field API names from source objects are cryptic and dashboards display system names instead of business-readable labels.
How it works:
GET /wave/datasets/{id}/xmds/main — read and save as backup.
- Locate the target field in the
dimensions or measures array.
- Construct the PATCH payload with only the
label property changed:
{
"dimensions": [
{
"field": "Account_Type__c",
"label": "Account Category"
}
]
}
PATCH /wave/datasets/{id}/xmds/main. Verify HTTP 200.
- Confirm label in Analytics Studio lens.
Pattern: External CSV Augmentation in Recipe
When to use: When a recipe needs to enrich CRM Analytics data with a reference table not available as a Salesforce object (e.g., a product category mapping from an ERP system).
How it works:
- Upload CSV to Salesforce Files via UI or Content API.
- In Analytics Studio Recipe Builder, add a Files node and select the uploaded CSV.
- Add an Augment node joining the Files node to the primary data node on the shared key field.
- Ensure the join key exists in both sources with the same data type.
- Schedule the recipe. When the external CSV changes, update the Salesforce File before the next recipe run.
Decision Guidance
| Situation |
Recommended Approach |
Reason |
| Field label change for all users |
PATCH main XMD |
Main XMD applies org-wide |
| Personal field label preference |
PATCH user XMD |
User XMD is per-user only |
| Read field schema without modifying |
GET system XMD |
System XMD has the raw schema |
| SOQL query for WaveXmd |
Use REST API instead |
SOQL does not support WaveXmd |
| Reference data from non-Salesforce source |
Files node + Augment in recipe |
CRM Analytics recipe supports CSV augmentation |
| Reclassify numeric field to dimension |
PATCH main XMD, move field to dimensions array |
Measure/dimension classification is in main XMD |
Recommended Workflow
Step-by-step instructions for an AI agent or practitioner working on this task:
- Obtain the dataset ID — Use
GET /wave/datasets?q={name} or find the dataset ID in the Analytics Studio URL.
- Back up current main XMD —
GET /wave/datasets/{id}/xmds/main and save the response. There is no recovery after PATCH.
- Identify fields to update — List field API names that need label, format, or classification changes. Confirm whether they appear in
dimensions or measures in system XMD.
- Construct PATCH payload — Build a minimal additive-merge JSON containing only changed properties.
- PATCH main XMD —
PATCH /wave/datasets/{id}/xmds/main. Verify HTTP 200.
- For external augmentation — Upload CSV to Salesforce Files, add Files node in recipe, connect Augment node on join key, re-run recipe, verify field availability in output dataset.
- Validate in Analytics Studio — Open a lens and confirm labels, formats, and classification are correct.
Review Checklist
Run through these before marking work in this area complete:
Salesforce-Specific Gotchas
SOQL cannot query WaveXmd — SELECT … FROM WaveXmd throws INVALID_TYPE. XMD is accessible only via the Wave REST API. Any documentation or code referencing SOQL for WaveXmd is incorrect.
Modifying system XMD fails with HTTP 400 — System XMD is immutable. Always confirm the endpoint is xmds/main, not xmds/system.
Main XMD is not versioned — no undo after PATCH — Always GET and save main XMD before modification. If PATCH is applied with incorrect data, the previous state is lost.
External CSV files are not auto-refreshed — Files node data is static until the Salesforce File is manually updated. If the reference CSV changes frequently, build a Salesforce Files API upload step into the deployment pipeline.
Output Artifacts
| Artifact |
Description |
| XMD backup JSON |
GET response of main XMD before modification |
| XMD PATCH payload |
Minimal additive-merge JSON for field label/format changes |
| External augmentation recipe plan |
Node diagram for Files + Augment join configuration |
Related Skills
admin/analytics-recipe-design — Use for recipe node type selection, join matrices, formula language, and scheduling
admin/analytics-dataflow-development — Use for sfdcDigest, Augment, and sfdcRegister node configuration in legacy dataflows
admin/analytics-dataset-management — Use for dataset scheduling, row limits, and sharing configuration
data/einstein-analytics-data-model — Use for conceptual understanding of the XMD layer hierarchy and dataset versioning model
1---2name: analytics-data-preparation3description: "Use this skill when customizing CRM Analytics dataset field metadata via the XMD (Extended Metadata) REST API, or augmenting recipes with external non-Salesforce data: field labels, display formats, measures vs dimensions, main XMD PATCH. Trigger keywords: XMD field labels, CRM Analytics main XMD update, dataset field formatting wave, analytics external data augmentation, WaveXmd REST API. NOT for recipe node transformation logic — use admin/analytics-recipe-design. NOT for dataflow node types or SOQL extraction — use admin/analytics-dataflow-development."4category: data5salesforce-version: "Spring '25+"6well-architected-pillars:7 - Reliability8 - Operational Excellence9triggers:10 - "how do I update field labels in a CRM Analytics dataset using the REST API"11 - "my WaveXmd PATCH request is wiping out existing field settings in CRM Analytics"12 - "how do I augment a CRM Analytics dataset with external CSV data not in Salesforce"13 - "what HTTP method should I use to update main XMD versus system XMD in CRM Analytics"14 - "can I use SOQL to read WaveXmd metadata from a CRM Analytics dataset"15 - "how do I back up the current XMD before making changes to a CRM Analytics dataset"16 - "PATCH main XMD CRM Analytics REST API field formatting overwriting"17tags:18 - crm-analytics19 - xmd20 - dataset-metadata21 - analytics22 - data-preparation23inputs:24 - "CRM Analytics dataset ID and API name"25 - "Field API names requiring label or format changes"26 - "Target XMD layer: main (org-wide) or user (per-user)"27 - "External data source details if augmenting datasets with non-CRM data"28outputs:29 - "XMD PATCH payload for field-level formatting and label changes"30 - "Step-by-step XMD update procedure using the Wave REST API"31 - "External data augmentation design using Files node and Augment node in recipe"32dependencies: []33version: 1.0.034author: Pranav Nagrecha35updated: 2026-04-1636metadata:37 source: https://skillmd.com/skills/pranavnagrecha/analytics-data-preparation38---3940# Analytics Data Preparation (XMD Metadata and External Augmentation)4142Use this skill when applying field-level metadata customizations to CRM Analytics datasets using the XMD REST API to set labels, aliases, date formats, number formats, and measure/dimension classification at the org level. Also covers the external data augmentation pattern for incorporating non-Salesforce data into CRM Analytics recipes.4344---4546## Before Starting4748Gather this context before working on anything in this domain:4950- What is the dataset ID (not API name — find via `GET /wave/datasets` or the Analytics Studio URL)?51- Is the change org-wide (PATCH main XMD) or personal preference (PATCH user XMD)?52- Are there external CSV files or Salesforce Files to be loaded as a recipe lookup source?53- Is this a one-time metadata update or part of a deployment pipeline requiring automated XMD updates post-dataflow?5455---5657## Core Concepts5859### XMD Layer Hierarchy6061CRM Analytics uses a three-layer Extended Metadata (XMD) system:62631. **System XMD** (`type=system`): Platform-generated. Immutable. Contains raw field API names and inferred data types. Cannot be modified — PATCH returns HTTP 400.642. **Main XMD** (`type=main`): Org-customizable. PATCH this layer to apply field label, format, and classification changes for all users.653. **User XMD** (`type=user`): Per-user customizations. Overrides main XMD only for the user who created the customization.6667Resolution order at render time: user XMD → main XMD → system XMD (first non-null value wins).6869### XMD REST API Mechanics7071```72GET /services/data/v{version}/wave/datasets/{datasetId}/xmds/{xmdtype}73PATCH /services/data/v{version}/wave/datasets/{datasetId}/xmds/{xmdtype}74```7576**Key behaviors:**77- PATCH is an **additive merge** — include only properties you want to change.78- System XMD PATCH returns HTTP 400.79- WaveXmd is **NOT queryable via SOQL** — the REST API is the only interface. SOQL throws INVALID_TYPE.80- Main XMD has no version history — PATCH is destructive. Always GET and save a backup before modifying.8182### External Data Augmentation Pattern8384CRM Analytics recipes support loading external data via:851. **Files node (CSV)**: Upload a CSV to Salesforce Files (ContentDocument), then reference it in a Recipe Files node. Best for reference data such as product hierarchies, territory mappings, or cost tables that do not exist in Salesforce objects.862. **Augment node**: Join the Files node dataset to a primary dataset inside the recipe. The Augment node performs a left outer join keyed on a shared field.8788External CSV data loaded via Files node is NOT subject to automatic incremental sync — it must be manually re-uploaded or replaced via Salesforce Files API to refresh the data.8990---9192## Common Patterns9394### Pattern: PATCH Main XMD for Field Label Updates9596**When to use:** After dataflow or recipe deployment when field API names from source objects are cryptic and dashboards display system names instead of business-readable labels.9798**How it works:**991. `GET /wave/datasets/{id}/xmds/main` — read and save as backup.1002. Locate the target field in the `dimensions` or `measures` array.1013. Construct the PATCH payload with only the `label` property changed:102```json103{104 "dimensions": [105 {106 "field": "Account_Type__c",107 "label": "Account Category"108 }109 ]110}111```1124. `PATCH /wave/datasets/{id}/xmds/main`. Verify HTTP 200.1135. Confirm label in Analytics Studio lens.114115### Pattern: External CSV Augmentation in Recipe116117**When to use:** When a recipe needs to enrich CRM Analytics data with a reference table not available as a Salesforce object (e.g., a product category mapping from an ERP system).118119**How it works:**1201. Upload CSV to Salesforce Files via UI or Content API.1212. In Analytics Studio Recipe Builder, add a Files node and select the uploaded CSV.1223. Add an Augment node joining the Files node to the primary data node on the shared key field.1234. Ensure the join key exists in both sources with the same data type.1245. Schedule the recipe. When the external CSV changes, update the Salesforce File before the next recipe run.125126---127128## Decision Guidance129130| Situation | Recommended Approach | Reason |131|---|---|---|132| Field label change for all users | PATCH main XMD | Main XMD applies org-wide |133| Personal field label preference | PATCH user XMD | User XMD is per-user only |134| Read field schema without modifying | GET system XMD | System XMD has the raw schema |135| SOQL query for WaveXmd | Use REST API instead | SOQL does not support WaveXmd |136| Reference data from non-Salesforce source | Files node + Augment in recipe | CRM Analytics recipe supports CSV augmentation |137| Reclassify numeric field to dimension | PATCH main XMD, move field to `dimensions` array | Measure/dimension classification is in main XMD |138139---140141## Recommended Workflow142143Step-by-step instructions for an AI agent or practitioner working on this task:1441451. **Obtain the dataset ID** — Use `GET /wave/datasets?q={name}` or find the dataset ID in the Analytics Studio URL.1462. **Back up current main XMD** — `GET /wave/datasets/{id}/xmds/main` and save the response. There is no recovery after PATCH.1473. **Identify fields to update** — List field API names that need label, format, or classification changes. Confirm whether they appear in `dimensions` or `measures` in system XMD.1484. **Construct PATCH payload** — Build a minimal additive-merge JSON containing only changed properties.1495. **PATCH main XMD** — `PATCH /wave/datasets/{id}/xmds/main`. Verify HTTP 200.1506. **For external augmentation** — Upload CSV to Salesforce Files, add Files node in recipe, connect Augment node on join key, re-run recipe, verify field availability in output dataset.1517. **Validate in Analytics Studio** — Open a lens and confirm labels, formats, and classification are correct.152153---154155## Review Checklist156157Run through these before marking work in this area complete:158159- [ ] Main XMD backed up before PATCH160- [ ] PATCH targeted at `xmds/main` (not `xmds/system`)161- [ ] PATCH payload is additive-merge format (not full replace)162- [ ] HTTP 200 confirmed on PATCH response163- [ ] Field labels verified in Analytics Studio lens164- [ ] For external data: Augment node join key is the same data type in both sources165- [ ] CSV refresh process documented for recurring updates166167---168169## Salesforce-Specific Gotchas1701711. **SOQL cannot query WaveXmd** — `SELECT … FROM WaveXmd` throws INVALID_TYPE. XMD is accessible only via the Wave REST API. Any documentation or code referencing SOQL for WaveXmd is incorrect.1721732. **Modifying system XMD fails with HTTP 400** — System XMD is immutable. Always confirm the endpoint is `xmds/main`, not `xmds/system`.1741753. **Main XMD is not versioned — no undo after PATCH** — Always GET and save main XMD before modification. If PATCH is applied with incorrect data, the previous state is lost.1761774. **External CSV files are not auto-refreshed** — Files node data is static until the Salesforce File is manually updated. If the reference CSV changes frequently, build a Salesforce Files API upload step into the deployment pipeline.178179---180181## Output Artifacts182183| Artifact | Description |184|---|---|185| XMD backup JSON | GET response of main XMD before modification |186| XMD PATCH payload | Minimal additive-merge JSON for field label/format changes |187| External augmentation recipe plan | Node diagram for Files + Augment join configuration |188189---190191## Related Skills192193- `admin/analytics-recipe-design` — Use for recipe node type selection, join matrices, formula language, and scheduling194- `admin/analytics-dataflow-development` — Use for sfdcDigest, Augment, and sfdcRegister node configuration in legacy dataflows195- `admin/analytics-dataset-management` — Use for dataset scheduling, row limits, and sharing configuration196- `data/einstein-analytics-data-model` — Use for conceptual understanding of the XMD layer hierarchy and dataset versioning model