Loading
Vlocity Contract Lifecycle Management
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          clmOsDocxGenerateDocument Lightning Web Component

          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.

          Note
          Note

          This feature is available for the following users only:

          • ​Salesforce Industries Communications, Media, and Energy Spring '20 and later releases.

          • Vlocity Insurance Spring '20 and later releases.

          It contains the following components:

          • 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.

          Important
          Important

          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.

          Example JSON Node

          "selectedTemplate": {
              "Name": "__NewTemplate",
              "Id": "a0Xf4000009I0chEAC",
              "VersionNumber": 1,
              "TemplateType": "Microsoft Word .DOCX Template"
            }

          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.
          Important
          Important

          You must use kebab case in the Omniscript for property names in order to map to the corresponding global variable in the LWC.

          For example, in the Omniscript, you use selected-template to map to the LWC selectedTemplate global variable.

          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.

          example
          example

          Using isWordAttachDone Example

          To show the Email Document button only after the document is generated, you can add a filter in the Omniscript with isWordAttachDone = true.

          isWordAttachDone = True

          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.

          example
          example

          Using isPDFAttachDone Example

          To show the Email PDF Document button only after the document is generated, you can add a filter in the Omniscript with isPDFAttachDone = true.

          isPDFAttachDone = True

          Event Details JSON Format for clmOsDocxGenerateDocument

          clmdocgencomplete The event data for the Microsoft Word document has the following keys.

          FlagVariableDescription
          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.

          FlagVariableDescription
          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

          Used in Other Vlocity CLM Lightning Web Components for clmOsDocxGenerateDocument

          None. This is a top-level component.

           
          Loading
          Salesforce Help | Article