document-generation

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

33|12|Updated Sep 24, 2024
One-click install
npx skills add https://github.com/bgaldino/rlm-base-dev --skill document-generation-bgaldino
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: document-generation
Source: https://github.com/bgaldino/rlm-base-dev/tree/main/.cursor/skills/document-generation
Command: npx skills add https://github.com/bgaldino/rlm-base-dev --skill document-generation-bgaldino

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires python-docx.

What problem does it solve? Building Salesforce OmniStudio document templates fails in opaque ways: blank tokens, silent Extract failures, phantom array rows, and engine crashes from malformed image or hyperlink contracts. This Skill provides the verified token syntax, Extract/Transform ODT wiring rules, lifecycle procedures, and troubleshooting tables needed to produce working invoice, quote, and contract documents. ## Core Features & Use Cases - Template authoring and token mapping: Defines the full token contract (scalar, repeating sections, IF_ conditions, IMG_ images, HYP_ links, RTB_ rich text) and how Transform output keys must match .docx tokens exactly. - Extract/Transform ODT wiring: Documents object query join patterns, filter semantics, formula function catalog, and the depth-uniformity rules that prevent cartesian products and phantom rows. - Lifecycle and verification tooling: Covers docgen_template_* scripts for template build, token extraction, activation/deactivation, and end-to-end generation smoke tests via DocumentGenerationProcess. - Use Case: Add a new field to a quote proposal template by inserting the token in the .docx, adding a field mapping to the Extract ODT, a pass-through to the Transform ODT, reactivating both ODTs, replacing the template binary, and verifying with a generation run. ## Quick Start Use the document-generation skill to add a BillingCity token to the RLM_QuoteProposal template and verify it renders by running 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 ODT mapping?

Create a DocumentTemplate of Type MicrosoftWord with TokenMappingMethodType OmniDataTransform, referencing one Extract and one Transform ODT by exact name. Build the .docx with mustache tokens, wire the ODTs while the template is in Draft status, then reactivate and test with a generation run.

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

Place a plain-text {{IMG_name}} token in the template and have the Transform output a nested object with src, width, and height. The src must be a ContentDocument ID (069 prefix), all three fields are mandatory, and the Integration User needs Content Library access.

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 paths. Validate items with docgen_odt_validate.py and execute the Extract standalone to isolate the failing stage.

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

No. Salesforce documents OmniDataTransform records as internal use only, so create/edit/delete via SObject REST is appropriate only for scratch-org experimentation and debugging. For committed or production work, author Metadata API XML and deploy it.

Why does my repeating section show extra phantom rows?

Phantom rows occur when field mappings for the same output array read from mixed hierarchy depths and a deeper join is a child-of relationship. Fix it with the redundant join pattern so all mappings read from uniform child depth, and verify with docgen_odt_inspect_hierarchy.py.

Which formula functions are supported in OmniDataTransform formulas?

Supported functions include IF, ISBLANK, CONCAT, SUBSTRING, LIST, FUNCTION, arithmetic, comparisons, AND/OR/NOT, and ABS/ROUND/FLOOR/CEILING/MAX/MIN. Unsupported functions like CASE, LEN, UPPER, TEXT, and MOD save silently with a null FormulaConverted and produce no output.