forcedotcom/sf-skills / skills/crm-analytics-wave-generate
crm-analytics-wave-generate
VerifiedUse 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.
scripts/verify_dashboard_steps.js
View on GitHub#!/usr/bin/env node
// For each step in a deployed dashboard, GET stored SAQL, decode HTML entities,
// swap dataset name for id/version, POST to /wave/query. Prints HTTP status + row count per step.
// Edit DASH_ID and DS constants at the top before running.
// Usage: node scripts/verify_dashboard_steps.js <alias>
const { execSync, execFileSync } = require("child_process");
// ── Edit these constants before running ──────────────────────────────────────
const DASH_ID = "0FK000000000000AAA"; // Wave Dashboard 18-char ID
const DS = {
name: "MyDataset", // Name-based load identifier used in stored SAQL
id: "0Fb000000000000AAA", // Dataset 18-char ID
versionId: "0Fc000000000000AAA", // Current version ID
};
// ─────────────────────────────────────────────────────────────────────────────
function getOrgCredentials(alias) {
const result = execFileSync('sf', ['org', 'display', '-o', alias, '--json'], { encoding: "utf8" });
const json = JSON.parse(result);
return { accessToken: json.result.accessToken, instanceUrl: json.result.instanceUrl };
}
function apiFetch(instanceUrl, accessToken, apiPath, method = "GET", body = null) {
const url = `${instanceUrl}${apiPath}`;
const args = [
"-s",
"-H", `Authorization: Bearer ${accessToken}`,
"-H", "Content-Type: application/json",
"-X", method,
"-w", "\\nHTTP_STATUS:%{http_code}",
];
if (body !== null) args.push("-d", JSON.stringify(body));
args.push(url);
const raw = execSync(`curl ${args.map(a => `'${String(a).replace(/'/g, "'\\''")}'`).join(" ")}`, {
encoding: "utf8", maxBuffer: 10 * 1024 * 1024,
});
const parts = raw.split("\nHTTP_STATUS:");
const httpStatus = parseInt(parts[1] || "0", 10);
let parsed = null;
try { parsed = JSON.parse(parts[0]); } catch { parsed = parts[0]; }
return { httpStatus, body: parsed };
}
function decodeHtmlEntities(s) {
let prev = null;
while (prev !== s) {
prev = s;
s = s.replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&');
}
return s;
}
const [,, alias] = process.argv;
if (!alias) {
console.error("Usage: node verify_dashboard_steps.js <alias>");
console.error("Edit DASH_ID and DS constants at the top of this file before running.");
process.exit(1);
}
const { accessToken, instanceUrl } = getOrgCredentials(alias);
// Fetch dashboard state
const { httpStatus: dashStatus, body: dash } = apiFetch(instanceUrl, accessToken, `/services/data/v59.0/wave/dashboards/${DASH_ID}`);
if (dashStatus !== 200) {
console.error(`Failed to fetch dashboard ${DASH_ID}: HTTP ${dashStatus}`);
process.exit(1);
}
const steps = dash.state?.steps || {};
const stepNames = Object.keys(steps);
const results = [];
for (const stepName of stepNames) {
const step = steps[stepName];
if (step.type !== "saql") {
results.push({ step: stepName, type: step.type, skipped: true, reason: "non-saql step" });
continue;
}
const decoded = decodeHtmlEntities(step.query || "");
// Swap name-based load for id/version for /wave/query
const queryForVerify = decoded.replace(
new RegExp(`"${DS.name}"`, "g"),
`"${DS.id}/${DS.versionId}"`
);
const { httpStatus, body: queryResult } = apiFetch(
instanceUrl, accessToken, "/services/data/v59.0/wave/query", "POST",
{ query: queryForVerify, queryLanguage: "SAQL" }
);
const rowCount = queryResult.results?.records?.length ?? null;
results.push({ step: stepName, httpStatus, rowCount, ok: httpStatus === 200 && rowCount !== null });
}
const allOk = results.every(r => r.skipped || r.ok);
console.log(JSON.stringify({ allOk, steps: results }, null, 2));
process.exit(allOk ? 0 : 1);
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 471k | Updated | Claude CodeCodex | Verified | Install |
| 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: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |