Skip to content

forcedotcom/sf-skills / skills/crm-analytics-wave-generate

crm-analytics-wave-generate

Verified

Use to build a Wave Recipe, deploy a CRM Analytics dataset or dashboard, or author the full CRMA asset stack — apps, Wave Recipes (.wdpr), datasets, and dashboards — against a connected Salesforce org via REST and Metadata APIs, without CRM Analytics Studio or Dashboard Builder. TRIGGER when: user asks to build or create a Wave Recipe, generate a .wdpr or .wdpr-meta.xml, deploy a .wdash or .wapp, run a recipe or dataflowjob programmatically, upload CSV data via InsightsExternalData, validate a dataset schema with synthetic data, fetch dataset XMD, audit dashboard SAQL re-encoding, or find unused dataset fields. TRIGGER on keywords: Wave Recipe, CRMA, CRM Analytics, wdpr, wdash, wapp, WaveRecipe, Wave dataflow, dataflowjob, InsightsExternalData, SAQL, dataset XMD, Analytics Studio, R3 format, wave/recipes, wave/dashboards, or analytics on Salesforce objects (opportunities, leads, cases, accounts, sales). DO NOT TRIGGER for standard Salesforce reports or LWC components unrelated to CRM Analytics.

references/external-data-upload.md

View on GitHub
# External Data Uploads (CSV → Dataset)

Use this when landing a CSV into a Wave dataset without running a recipe — e.g. synthetic test data, one-off external feeds, or standing up a dashboard before recipe sources are available.

## Process (4 steps)

1. `POST /services/data/v66.0/sobjects/InsightsExternalData` with:
   ```json
   { "Format": "Csv", "EdgemartAlias": "<datasetName>", "EdgemartContainer": "<folderId>",
     "Operation": "Overwrite", "Action": "None", "MetadataJson": "<base64 of metadata.json>" }
   ```
   Returns `{ id }` — the header id.

2. `POST /services/data/v66.0/sobjects/InsightsExternalDataPart` for each chunk:
   ```json
   { "InsightsExternalDataId": "<headerId>", "PartNumber": 1, "DataFile": "<base64 of CSV bytes>" }
   ```
   Keep parts ≤ 8 MB.

3. `PATCH /services/data/v66.0/sobjects/InsightsExternalData/<headerId>` with `{ "Action": "Process" }`. Returns 204; ingestion is queued.

4. Poll: `SELECT Id, Status, StatusMessage FROM InsightsExternalData WHERE Id = '<headerId>'`. Status flow: `New` → `Queued` → `InProgress` → `Completed` | `CompletedWithWarnings` | `Failed`.

## metadata.json minimum-viable schema

```json
{
  "fileFormat": { "charsetName": "UTF-8", "fieldsDelimitedBy": ",", "linesTerminatedBy": "\n", "numberOfLinesToIgnore": 1 },
  "objects": [{
    "connector": "CSV",
    "fullyQualifiedName": "<datasetName>",
    "name": "<datasetName>",
    "label": "<display label>",
    "fields": [
      { "name": "AccountId",    "fullyQualifiedName": "AccountId",    "label": "Account ID",    "type": "Text" },
      { "name": "TotalRevenue", "fullyQualifiedName": "TotalRevenue", "label": "Total Revenue", "type": "Numeric", "precision": 18, "scale": 2, "defaultValue": "0", "format": "$#,##0.00" }
    ]
  }]
}
```

## Critical rules

- **Every field needs `fullyQualifiedName`** — omitting it returns `FIELD_INTEGRITY_EXCEPTION: The fully-qualified name for field [X] cannot be empty`.
- **Field names cannot contain dots** — recipe join fields like `Account.Name` must be renamed `Account_Name`. Labels can keep the original spelling.
- **`type`** must be `Text`, `Numeric`, or `Date`. For Numeric: supply `precision` + `scale`. For Date: `format` must be a SimpleDateFormat string (e.g. `"yyyy-MM-dd"`).
- **CSV nulls** are empty fields — do not write the literal string `null`.
- **Folder** = `EdgemartContainer` is the WaveApplication folder id from `GET /wave/folders`, not the folder name.
- **Operation modes**: `Overwrite` replaces data; `Append` adds rows; `Upsert` requires `isUniqueId: true`; `Delete` removes rows matching key.
- **A 200 on Action=Process ≠ data is queryable.** Wait for `Status = Completed`, then verify with a SAQL count query.

## Common errors

| Symptom | Cause | Fix |
|---------|-------|-----|
| `FIELD_INTEGRITY_EXCEPTION: fully-qualified name … cannot be empty` | Missing `fullyQualifiedName` | Add to every field |
| `Object name not allowed` / dot in name | Dataset or field name contains `.` or `-` | Use `[A-Za-z][A-Za-z0-9_]*` only |
| `Status: Failed` referencing a specific row | CSV value doesn't parse as declared type | Check row in `StatusMessage`; ensure no currency symbols in numeric data |
| `Status: Completed` but 0 rows | Wrong `Operation` or `numberOfLinesToIgnore` too large | Check both values |
| SAQL `Syntax Error … as 'rows'` | `rows` is a reserved SAQL word | Use `'row_count'` or `'cnt'` as alias |
| `Invalid group expression: <Field>` (errorCode 119) | Field is a measure (NUMBER type) in XMD | Use `case` in SAQL or change recipe to emit TEXT version |
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall