document-generation

Create and troubleshoot Salesforce OmniStudio .docx templates and DocumentTemplate lifecycle operations.

5|3|Updated Sep 9, 2026
One-click install
npx skills add https://github.com/SalesforceLabs/revenue-cloud-foundations --skill document-generation-salesforcelabs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: document-generation
Source: https://github.com/SalesforceLabs/revenue-cloud-foundations/tree/main/.cursor/skills/document-generation
Command: npx skills add https://github.com/SalesforceLabs/revenue-cloud-foundations --skill document-generation-salesforcelabs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires python-docx.

What problem does it solve? Building Salesforce OmniStudio document templates involves opaque token syntax, strict Extract/Transform ODT wiring, and silent failure modes (blank output, phantom rows, engine crashes) that are hard to diagnose without deep platform knowledge. ## Core Features & Use Cases - Template authoring and token mapping: Create and modify .docx templates with scalar, repeating-section, conditional, image, hyperlink, and rich-text tokens, then wire them to Extract and Transform OmniDataTransforms. - Lifecycle and generation automation: Use canonical docgen_template_* scripts to build templates, extract tokens, activate/deactivate, upload binaries, and run end-to-end generation smoke tests. - Troubleshooting and validation: Diagnose blank output, cartesian-product explosions, mixed-depth phantom rows, and dynamic image failures using live-verified engine behavior references and static lint/diff helpers. - Use Case: You need an invoice template that lists line items with per-product usage grants and a dynamic company logo; this skill guides the Extract hierarchy, Transform formulas, IMG_ token contract, and verification pipeline. ## Quick Start Ask the agent to create a Salesforce OmniStudio invoice .docx template wired to Extract and Transform ODTs and verify it with an end-to-end generation test.

Frequently Asked Questions about document-generation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Salesforce OmniStudio document template with tokens?

Create a .docx with mustache tokens ({{Field}} for scalars, {{#Section}} for repeating rows), then wire a DocumentTemplate record to one Extract and one Transform ODT by name. Use the docgen_template_manage.py script to upload, activate, and generate output.

How do I add dynamic images to a Salesforce document template?

Place a plain-text {{IMG_name}} token and have the Transform output an object with src, width, and height. The src must be a ContentDocument ID (069 prefix), and both dimensions are required or the image silently fails to render.

Why is my OmniStudio document generation output blank?

Blank output usually means the Extract is failing: check for duplicate object query items, null OutputObjectName values, or dot notation in InputFieldName (use colons). Run docgen_odt_validate.py to lint items and docgen_odt_execute.py to test the Extract directly.

Can I use the SObject REST API to edit OmniDataTransforms in production?

No. Salesforce documents OmniDataTransform records as internal use only; create, edit, or delete operations via SObject REST are unsupported outside scratch orgs. For committed work, author Metadata API XML (.rpt-meta.xml) and deploy it.

What causes phantom rows in OmniStudio Extract output arrays?

Phantom rows occur when field mappings for the same output array read from mixed hierarchy depths and a deeper join is a child-of (one-to-many) query. Fix it with the redundant join pattern so all mappings read from uniform child depth.