forcedotcom/sf-skills / plugins/builder/consumer-goods/skills/consumer-goods-tpe-datakit-deploy
consumer-goods-tpe-datakit-deploy
VerifiedDeploy the TPM Accruals Data Kit components specifically required for Trade Promotion Effectiveness (TPE) dashboards. Use when a customer or admin wants to install or deploy the TPM data kit for TPE dashboards, or as a delegated step from consumer-goods-tpe-dashboard-configure. Do not use this skill if the customer wants to deploy the TPM Accruals Data Kit for the Accruals feature.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 15.2 KB |
| scripts/detect-namespace.jsexecutable | script | 2.3 KB |
| scripts/download-static-resource.jsexecutable | script | 5.6 KB |
| scripts/extract-crm-field-permissions.jsexecutable | script | 3.9 KB |
| scripts/sf-rest.js | script | 3.5 KB |
| scripts/update-field-permissions.jsexecutable | script | 17.0 KB |
scripts/extract-crm-field-permissions.js
View on GitHub#!/usr/bin/env node
/**
* Extracts the exact {sobject, fields[]} list the TPM Accruals Data Kit
* reads from Salesforce, straight out of the downloaded package's
* `dataSourceObjects` metadata — so the field-permissions grant step never
* has to guess or hardcode which objects/fields matter. Scans every
* `*.dataSourceObject-meta.xml` in the given directory, keeps only the ones
* with `<dataSource>Salesforce_Home</dataSource>` (the CRM streams; every
* other `dataSource` value in that folder is a Data Cloud-side or
* already-computed object, not a CRM read), and for each one collects
* `<externalName>` from every `<dataSourceFields>` block EXCEPT the
* `isFormula=true` ones (`DataSource`, `DataSourceObject` — computed
* literals baked into the package, never real Salesforce fields).
* `<externalName>` values are already namespace-resolved for the org this
* package was downloaded from — never re-prefix them.
*
* Deliberately regex-based, not a full XML parser — this metadata format is
* simple/flat enough (no nested same-name tags, no CDATA) and this keeps the
* skill dependency-free per this repo's self-contained-skills rule.
*
* Usage:
* node extract-crm-field-permissions.js --dir <path-to-dataSourceObjects>
*
* Prints one line of JSON to stdout: [{"sobject":"Account","fields":[...]}, ...]
* Exit codes: 0 = success (including a directory with zero Salesforce_Home
* files — an empty array is printed), 1 = usage/read error.
*/
const fs = require('fs');
const path = require('path');
function parseArgs(argv) {
const args = {};
for (let i = 0; i < argv.length; i += 1) {
const token = argv[i];
if (!token.startsWith('--')) continue;
args[token.slice(2)] = argv[i + 1];
i += 1;
}
return args;
}
function requireArg(args, name) {
if (!args[name]) {
console.error(`Missing required --${name}`);
process.exit(1);
}
return args[name];
}
function unescapeXml(value) {
return value
.replace(/'/g, "'")
.replace(/"/g, '"')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/&/g, '&');
}
function extractTag(xml, tagName) {
const match = new RegExp(`<${tagName}>([^<]*)</${tagName}>`).exec(xml);
return match ? unescapeXml(match[1]) : undefined;
}
function parseDataSourceObjectXml(xml) {
const dataSource = extractTag(xml, 'dataSource');
const sobject = extractTag(xml, 'externalRecordIdentifier');
const fields = [];
const fieldBlockRe = /<dataSourceFields>([\s\S]*?)<\/dataSourceFields>/g;
let blockMatch;
while ((blockMatch = fieldBlockRe.exec(xml))) {
const block = blockMatch[1];
const isFormula = extractTag(block, 'isFormula') === 'true';
const externalName = extractTag(block, 'externalName');
if (!isFormula && externalName) {
fields.push(externalName);
}
}
return { dataSource, sobject, fields };
}
function main() {
const args = parseArgs(process.argv.slice(2));
const dir = requireArg(args, 'dir');
let files;
try {
files = fs.readdirSync(dir).filter((f) => f.endsWith('.dataSourceObject-meta.xml'));
} catch (error) {
console.error(`extract-crm-field-permissions: could not read --dir "${dir}" — ${error.message}`);
process.exit(1);
}
const bySobject = new Map();
for (const file of files) {
const xml = fs.readFileSync(path.join(dir, file), 'utf8');
const { dataSource, sobject, fields } = parseDataSourceObjectXml(xml);
if (dataSource !== 'Salesforce_Home' || !sobject || !fields.length) continue;
const existing = bySobject.get(sobject) || new Set();
fields.forEach((f) => existing.add(f));
bySobject.set(sobject, existing);
}
const result = Array.from(bySobject.entries()).map(([sobject, fields]) => ({
sobject,
fields: Array.from(fields).sort(),
}));
process.stdout.write(JSON.stringify(result));
}
if (require.main === module) {
main();
}
module.exports = { parseDataSourceObjectXml };
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |