Loading
PHP Vulnerability Monitoring Read More
The online Trailblazer Community becomes read-only Oct 30, 2026Read More
Vlocity Contract Lifecycle Management
clmUtils Lightning Web Component

clmUtils Lightning Web Component

This Lightning Web Component is used in other Vlocity CLM Lightning Web Components. However, the clmUtils LWC is a service Lightning Web Component. Unlike other LWCs, this LWC has only a configuration and JS files.If you plan to extend any Vlocity CLM LWCs or create your own LWCs to use in Vlocity CLM Omniscripts, you can use the following utilities.

Note
Note

This feature is available for the following users only:

  • ​Salesforce Industries Communications, Media, and Energy Winter '20 and later

  • Vlocity Insurance Spring '20 and later

clmUtils.js

This is the generic CLM utility JS file. In other Vlocity CLM Lightning web components, sometimes the specific JS file needed is imported. If all the JS files will be needed, the Lightning web component imports the clmUtility.js file, which brings in all the other JS files with it.This file contains the following JS files in clmUtility.

clmOSDataFormatter.js

This utility does the following data sorting and formatting tasks:

  • formatRemoteActionData function

    • Responsible for preparing the input data for Remote Action by parsing through Omniscript data JSON

    • Checks for the Omniscript Data JSON, and if missing, throws an error from the label CLMLwcNoJsonDataError.

    • Checks for templateId in the input data JSON, and if missing, checks the templateType in templateData input parameter. If the templatetype is missing in templateData, it throws an error from the label CLMLwcNoTemplateTypeError. In return, it calls the formatQuery method.

  • formatQuery function

    • Used primarily by the formatRemoteActionData function

    • Parses through Omniscript data JSON to extract the useTemplateDRExtract parameter for Remote Action.

    • Builds inputMap and optionsMap for Remote Action.

    • Invokes parseMergeFields to parse through each of the Omniscript merge field parameters in omniGetMergeField and assigns it to inputMap and optionsMap

  • parseMergeFields function

    • Uses the omniGetMergeFields input parameter. This method parses merge fields when a Vlocity CLM top-level LWC is used in a Custom LWC element in an Omniscript.

clmAttachDocumentsUtils.js

This JS file handles document attachments and creates links to the parent object. This file includes methods that can be used for a generic object document creation Omniscript.

saveContentVersion

This method saves the generated document to Content Version and makes a remote action server call to clmAppHandler.saveContentVersion().

Input Parameters

fileName (Required) Name or title of the document to be saved in Content Version

fileContent (Required) Base64 format of Microsoft Word DOCX or PDF file that needs to be saved

linkContentVersion

This method is used for linking the saved document (ContentVersion) with the parent sObject. The parent SObject can be any standard Salesforce sObject, such as Quote, Order, Opportunity, or Contract.

This makes a remote action server call to clmAppHandler.linkContentVersion() with the isOmniCall parameter set to true.

Input Parameters

parentId (Required) sObject Id of Quote, Order, Opportunity or Contract

contentVersionId (Required) Saved contentVersionId that needs to be linked

linkDocumentToContractVersion

This method is used for linking the saved document (ContentVersion) with the contract version. The parent is always Contract Version for which the content version will be linked. This is primarily used in case of contract document generation for maintaining the versioning.

This makes a remote action server call to clmAppHandler.linkContentVersion() with the isOmniCall parameter set to false.

Input Parameters

contractVersionID (Required) Content VersionID for which the document needs to be linked

contentVersionId (Required) Saved ContentVersionId that needs to be linked

templateId (Required) Document templateId from which the document is generated

fileFormat (Required) Docx

clmCssStyleUtil.js

This JS file loads all the required CSS files for contract document generation or Omniscript document generation.This utility exposes the loadCssStyles function.

loadCssStyles

This loads the following style sheets for the LWC if they are not loaded:

  • slds

  • vlocity_assets

  • ContractDocumentCreationCss

Input Parameters

component Lightning Element of the LWC component that is invoking this function

clmDocumentActionUtil.js

This JS file loads all the required CSS files for contract document generation or Omniscript document generation.This utility exposes the getDocumentFileFormats function.

GetDocumentFileFormats

This method returns the Attachment File Format option and Download File Format option.

Input Parameters

You can use one of the following input parameters, but at least one is required.

  • contextId

  • contractId

  • contractVersionId

clmDocumentTemplateUtil.js

This JS file contains methods to extract document template details.

The following are functions exposed in this utility.

getTemplateListForVersion

This is a generic method to get the active template details for a contract version ID. This makes a remote action server call to ClmAppHandler.getTemplateListForVersion().

Input Parameters

data Contains inputMap and optionsMap

inputMap Needs to contain versionId as the key, which is the contract document version Id.

getTemplateFileContent

This method gets the Base64 converted data of content version that is attached for a document template. This makes a remote action server call to ClmAppHandler.getTemplateFileContent().

Input Parameters

data Contains inputMap and optionsMap

inputMap Needs to contain the templateCVId as the key with the value as the content version ID of the document attached for the document template.

getTemplateData

This is a generic method to get the template details for a templateId. This makes a remote action server call to ClmAppHandler.getTemplateData().

Input Parameters

data Contains inputMap and optionsMap

inputMap Needs to contain the templatId as the key with the value as the document template ID for which the data needs to be extracted

clmDocumentVersionUtil.js

This JS file contains methods to extract the details of an active contract document (Contract Versions).

This utility exposes the getActiveVersion function.

getActiveVersion

This is a generic method to get the details of a currently active contract Document (Contract Versions) for a specific contract Id.

Input Parameters

data Contains inputMap and optionsMap

inputMap Needs to contain the contextId as the key with the value as the contract Id.

clmDocxTemplaterUtil.js

This JS file contains methods that are responsible for loading all the required document generation static resources.

This utility exposes the loadUtilsScripts function.

loadUtilsScripts

This method is responsible for loading all the required document generation dependencies from static resources.

Input Parameters

component Contains the Lightning Element component of the parent LWC that invokes this function.

clmGenerateDocViaClientSide.js

This JS file contains methods is responsible for generating a Microsoft Word DOCX document on the Vlocity client-side.

This utility exposes the generateDocXFromTokenData function.

generateDocXFromTokenData

This method is responsible for generating a base64 representation of the Microsoft Word document.

Input Parameters

inputData Requires the following fields.

  • templateCVVersionData Base64 representation of the Content Version document attached to the template

  • docXTokenData A key value pair required for token replacements in the Microsoft Word DOCX template

  • documentName Title of the document

  • templateType Template type (currently only Microsoft Word DOCX templates are supported)

clmOmniscriptUtils.js

This JS file contains methods for supporting Omniscript functionalities.

This utility exposes the updateData function and clearStateOnChange function.

updateData

This method is responsible for updating the data to Omniscript data JSON and saves the element state.

Input Parameters

context Use this to reference the parent LWC.

example
example

Example

omniscriptUtils.updateData(this, selectedTemplate, stateData);

dataJsonPayload Data to add to Omniscript data JSON

stateData Allows component to resume in same state when user moves to previous or next step

clearStateOnChange

This method iterates through element names to clear each element's state.

Input Parameters

context Use this to reference the parent LWC.

clmRemoteAction.js

This JS file contains a generic method that accepts different parameters for calling a remote action.

This utility exposes the genericInvokeAction function.

genericInvokeAction

This method is responsible for routing all LWC remote actions. This method supports both Continuation and Queueable.

Input Parameters

data Must contain inputMap, optionsMap, className and methodName

Throws an error if any of these parameters are missing.

clmTokenDataUtil.js

This JS File contains a method that accepts contractId and templateId as the input parameters and returns the resolved token data that will be used in DocxTemplater for merging.

This utility exposes the getTokenData function.

getTokenData

This method is responsible for extracting DocX tokens for a given Contract Version Id and Template Id.

Input Parameters

data Contains inputMap and optionsMap

inputMap Requires the following fields.

  • contextId Use this as the key with the value as the contract document version Id if invoked from contract document generation. Or, you can use the SObjectId of Quote, Order, Opportunity, or Contract if invoked from an Omniscript.

  • templateId Uses this as the key with the value as the attached document template Id

  • isOmniCall Identifies the parent LWC that invoked this function

 
Loading
Salesforce Help | Article