You are here:
clmOsDocxGenerateDocument Lightning Web Component
Use clmOsDocxGenerateDocument top-level Lightning Web Component (LWC) to generate and attach a Microsoft Word document and .pdf document for a given sObject.
- clmShowtoast
- clmOsDocxGenerateWordDocument
- clmPdfConverter
To include this LWC in any Omniscript, use the Custom LWC element and then generate and attach a Microsoft Word document directly to the parent object.
The clmOsDocxGenerateDocument LWC supports only Microsoft Word DOCX templates.
Component LifeCycle for clmOsDocxGenerateDocument
You can play the video that demonstrates how the CLM LWCs work together. This is only a sample of how you can configure the CLM LWCs. You can configure them in other ways; for example, you can configure the clmpdfconversiondone event to be listened to by any LWC in any order.
- The clmOsDocxGenerateDocument LWC invokes the clmDocxGenerateWordDocument LWC for Microsoft Word document generation.
- The clmDocxGenerateWordDocument LWC invokes the
clmDocxPreviewDocument LWC to load the Microsoft Word
document.
At the same time, the clmDocxGenerateWordDocument LWC triggers the clmPdfConverter LWC if a PDF attachment or PDF download is required.
- The clmPdfConverter LWC fires the clmpdfconversiondone event as soon as the PDF content is available.
- The clmShowThumbnail LWC and the clmDocumentPreviewer LWC listens to the clmpdfconversiondone event, and enable the Download Word or Download PDF button.
Data Handling for clmOsDocxGenerateDocument
The clmOsDocxGenerateDocument.html file does the following:
- Invokes clmOsDocxGenerateWordDocument component for generating a Microsoft Word Document and handling the preview of the document
- Invokes clmPdfConverter LWC for generating the PDF document and firing the event for generating the PDF document.
The clmOsDocxGenerateDocument.js file takes the following input parameters:
Input Parameter | Required or Optional? | Description |
|---|---|---|
| context-id | Required | SObjectId, such as QuoteId, OpportunityId, OrderId or ContractID If the context-id is null, the file looks for the context-id in the data JSON of the Omniscript, which is set in the Set Values step. |
| selected-template | Required | Passes the selected template. This parameter accepts the JSOn format of the selected template as follows. For capturing selectedTemplate details, see clmSelectableItems Lightning Web Component. |
debug |
Optional |
Displays the debug statement for the template query when turned on |
document-title |
Optional |
Overrides the default document name of your document |
| keep-intermediate | Optional |
Specifies whether intermediate DOCX or PPTX files generated for PDF conversion are retained. When both attachFileFormat and downloadFileFormat are set to pdf, setting keep-intermediate=false, the system deletes the intermediate file after conversion, helping reduce storage usage. This parameter applies to singleDocxLwc, singleWebLwc, and multiDocxLwc Omniscripts through the LWCs ClmOsDocxGenerateDocument, ClmOsWebGenerateDocument, and ClmOsMultiDocxGenerateDocument. By default, keep-intermediate is set to true, preserving existing behavior. |
This component parses through the Omniscript data JSON to extract attachFileFormat and downloadFileFormat.
- Based on attachFileFormat values, the document (Word, PDF, or both) will be attached.
- Based on DownloadFileFormat values, the Download button for the document will be displayed or not.
Event Handlers for clmOsDocxGenerateDocument
After a Microsoft Word document is generated, an event name clmdocgencomplete is triggered for other LWCs.
After a PDF document is generated, an event name clmpdfconversiondone is triggered for other LWCs.
With the Omniscript, you can listen to the flag isWordAttachDone, which controls dependent elements. The event data is saved to the Omniscript data JSON.
With the Omniscript, you can listen to the flag isPDFAttachDone, which controls dependent elements.
The event details JSON format is saved to the Omniscript data JSON.
Event Details JSON Format for clmOsDocxGenerateDocument
clmdocgencomplete The event data for the Microsoft Word document has the following keys.
| Flag | Variable | Description |
|---|---|---|
| isWordAttachDone | Boolean | Returns true after the Microsoft Word document generation is complete. |
| docGenContentVersionId | String | Content Version Id of the generated Microsoft Word document. |
clmpdfconversiondone The event data for the PDF document has the following keys.
| Flag | Variable | Description |
|---|---|---|
| isPDFAttachDone | Boolean | Returns true after the PDF document generation is complete. |
| pdfGenContentVersionId | String | Content Version Id of the generated PDF document. |
Files Included for clmOsDocxGenerateDocument
clmOsDocxGenerateDocument includes the following files:
- clmOsDocxGenerateDocument.html
- clmOsDocxGenerateDocument.js
- clmOsDocxGenerateDocument.js-meta.xml
Other Vlocity and Salesforce Lightning Web Components Included for clmOsDocxGenerateDocument
The clmOsDocxGenerateDocument LWC extends the Salesforce LightningElement component.
Vlocity Lightning Web components included:
- toast
- pubsub
- OmniscriptBaseMixin
Salesforce Lightning Web components included:
- spinner
- api
- track
- LightningElement



