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.4---56# Analytics Data Preparation (XMD Metadata and External Augmentation)78Use 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.910---1112## Before Starting1314Gather this context before working on anything in this domain:1516- What is the dataset ID (not API name — find via `GET /wave/datasets` or the Analytics Studio URL)?17- Is the change org-wide (PATCH main XMD) or personal preference (PATCH user XMD)?18- Are there external CSV files or Salesforce Files to be loaded as a recipe lookup source?19- Is this a one-time metadata update or part of a deployment pipeline requiring automated XMD updates post-dataflow?2021---2223## Core Concepts2425### XMD Layer Hierarchy2627CRM Analytics uses a three-layer Extended Metadata (XMD) system:28291. **System XMD** (`type=system`): Platform-generated. Immutable. Contains raw field API names and inferred data types. Cannot be modified — PATCH returns HTTP 400.302. **Main XMD** (`type=main`): Org-customizable. PATCH this layer to apply field label, format, and classification changes for all users.313. **User XMD** (`type=user`): Per-user customizations. Overrides main XMD only for the user who created the customization.3233Resolution order at render time: user XMD → main XMD → system XMD (first non-null value wins).3435### XMD REST API Mechanics3637```38GET /services/data/v{version}/wave/datasets/{datasetId}/xmds/{xmdtype}39PATCH /services/data/v{version}/wave/datasets/{datasetId}/xmds/{xmdtype}40```4142**Key behaviors:**43- PATCH is an **additive merge** — include only properties you want to change.44- System XMD PATCH returns HTTP 400.45- WaveXmd is **NOT queryable via SOQL** — the REST API is the only interface. SOQL throws INVALID_TYPE.46- Main XMD has no version history — PATCH is destructive. Always GET and save a backup before modifying.4748### External Data Augmentation Pattern4950CRM Analytics recipes support loading external data via:511. **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.522. **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.5354External 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.5556---5758## Common Patterns5960### Pattern: PATCH Main XMD for Field Label Updates6162**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.6364**How it works:**651. `GET /wave/datasets/{id}/xmds/main` — read and save as backup.662. Locate the target field in the `dimensions` or `measures` array.673. Construct the PATCH payload with only the `label` property changed:68```json69{70 "dimensions": [71 {72 "field": "Account_Type__c",73 "label": "Account Category"74 }75 ]76}77```784. `PATCH /wave/datasets/{id}/xmds/main`. Verify HTTP 200.795. Confirm label in Analytics Studio lens.8081### Pattern: External CSV Augmentation in Recipe8283**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).8485**How it works:**861. Upload CSV to Salesforce Files via UI or Content API.872. In Analytics Studio Recipe Builder, add a Files node and select the uploaded CSV.883. Add an Augment node joining the Files node to the primary data node on the shared key field.894. Ensure the join key exists in both sources with the same data type.905. Schedule the recipe. When the external CSV changes, update the Salesforce File before the next recipe run.9192---9394## Decision Guidance9596| Situation | Recommended Approach | Reason |97|---|---|---|98| Field label change for all users | PATCH main XMD | Main XMD applies org-wide |99| Personal field label preference | PATCH user XMD | User XMD is per-user only |100| Read field schema without modifying | GET system XMD | System XMD has the raw schema |101| SOQL query for WaveXmd | Use REST API instead | SOQL does not support WaveXmd |102| Reference data from non-Salesforce source | Files node + Augment in recipe | CRM Analytics recipe supports CSV augmentation |103| Reclassify numeric field to dimension | PATCH main XMD, move field to `dimensions` array | Measure/dimension classification is in main XMD |104105---106107## Recommended Workflow108109Step-by-step instructions for an AI agent or practitioner working on this task:1101111. **Obtain the dataset ID** — Use `GET /wave/datasets?q={name}` or find the dataset ID in the Analytics Studio URL.1122. **Back up current main XMD** — `GET /wave/datasets/{id}/xmds/main` and save the response. There is no recovery after PATCH.1133. **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.1144. **Construct PATCH payload** — Build a minimal additive-merge JSON containing only changed properties.1155. **PATCH main XMD** — `PATCH /wave/datasets/{id}/xmds/main`. Verify HTTP 200.1166. **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.1177. **Validate in Analytics Studio** — Open a lens and confirm labels, formats, and classification are correct.118119---120121## Review Checklist122123Run through these before marking work in this area complete:124125- [ ] Main XMD backed up before PATCH126- [ ] PATCH targeted at `xmds/main` (not `xmds/system`)127- [ ] PATCH payload is additive-merge format (not full replace)128- [ ] HTTP 200 confirmed on PATCH response129- [ ] Field labels verified in Analytics Studio lens130- [ ] For external data: Augment node join key is the same data type in both sources131- [ ] CSV refresh process documented for recurring updates132133---134135## Salesforce-Specific Gotchas1361371. **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.1381392. **Modifying system XMD fails with HTTP 400** — System XMD is immutable. Always confirm the endpoint is `xmds/main`, not `xmds/system`.1401413. **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.1421434. **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.144145---146147## Output Artifacts148149| Artifact | Description |150|---|---|151| XMD backup JSON | GET response of main XMD before modification |152| XMD PATCH payload | Minimal additive-merge JSON for field label/format changes |153| External augmentation recipe plan | Node diagram for Files + Augment join configuration |154155---156157## Related Skills158159- `admin/analytics-recipe-design` — Use for recipe node type selection, join matrices, formula language, and scheduling160- `admin/analytics-dataflow-development` — Use for sfdcDigest, Augment, and sfdcRegister node configuration in legacy dataflows161- `admin/analytics-dataset-management` — Use for dataset scheduling, row limits, and sharing configuration162- `data/einstein-analytics-data-model` — Use for conceptual understanding of the XMD layer hierarchy and dataset versioning model