I have completed the following setup steps for OmniStudio Document Generation using IP response data. Are these steps correct and what should I do next? Steps You Have Completed:
1. Word Template
- Created a Word document with tokens matching the IP response JSON structure
- Example: {{Quote.QuoteNumber}}, {{Quote.AccountName}}
2. Document Template
- Created a Document Template in Salesforce
- Uploaded the Word template file
- Configured with:
- Token Mapping Method Type: Omni Data Transformation
- Document Generation Mechanism: Server-side
- Usage Type: Contract Lifecycle Management (CLM)
3. Data Mapper (ODT)
- Created a Data Mapper with:
- Type: Extract
- Input: JSON
- Output: JSON
- Configured extraction rules to pull Quote and QuoteLines data from Salesforce
4. Integration Procedure (IP)
- Created an IP
- Added a Data Mapper Extract Action that calls the Data Mapper
- Added a Response Action that returns data in the same structure as the Data Mapper output
5. OmniScript
- Took the standard Single Doc Core - DOCX Serverside(LWC) OmniScript
- Created a new version
- Added an Integration Procedure Action that calls the created IP
Are These Steps Correct?
@Jothish B S the standard osGenerateAndPreviewDocument component does not automatically take the response of any Integration Procedure action added earlier in the OmniScript and use it as token data. The generated document uses the JSON available to the document generation step, based on the template’s token mapping method.
Trailhead explains that document templates can use JSON input data, and that the Token Mapping Method controls how tokens are populated. It also says you can use OmniDataTransform or a custom class for that mapping. Reference: (Trailhead)
For your example token: {{Quote.QuoteNumber}} the JSON used by document generation must look like this:
{ "Quote": { "QuoteNumber": "Q-0001", "AccountName": "ABC Customer" }}If you have quote lines, the final JSON must also contain a repeatable array, for example:
{ "Quote": { "QuoteNumber": "Q-0001", "AccountName": "ABC Customer", "QuoteLines": [ { "ProductName": "Product A", "Quantity": 2 } ] }}Correction to do would be: don’t use an
Extract Data Mapper as the final token mapper if your source is already the IP response JSON. Use a Transform Data Mapper to shape the IP response into the exact JSON structure expected by the Word template.
Also open the OmniScript preview/debug panel and check the Data JSON after the IP action runs. If the Quote node is not present at the root, or if it is nested under something like IPResult.Quote, your tokens will not resolve.
For server-side generation, Salesforce also documents an Integration Procedure pattern using DocumentServiceGateway.generateDocumentWithTokenData, which is more suitable when the IP is responsible for preparing the full token JSON. Reference: (Salesforce)
Decide the pattern:
Use standard LWC + OmniScript JSON if the IP output is stored in the OmniScript JSON exactly as the template expects.
Use server-side IP document generation if the IP should fully control token data and document generation.
The missing part is mapping the IP response into the exact token JSON consumed by document generation.