Loading
Salesforce now sends email only from verified domains. Read More
Help Agent Performance DegradationRead More
Omnistudio Document Generation
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
          Customize the fndSingleDocxLwc Omniscript

          Customize the fndSingleDocxLwc Omniscript

          You can customize the fndSingleDocxLwc Omniscript according to your requirements. In this example, customize the Omniscript to set a default template and hide the pick a template window during the document generation process.

          You can then call this Omniscript from a custom Generate Document action button on any object such as a contract, order, quote, work order, or opportunity.

          To help you understand how this Omniscript works, refer to Step Properties for the fndSingleDocxLwc Omniscript.

          To modify the Omniscript, follow these instructions:

          1. Create a custom Generate Document button. Follow steps 1 to 3.
          2. Modify the Generate Document custom action to preselect the template for document generation by using the template ID.
            1. In Setup, click Object Manager.
            2. Click the object for which you created the custom Generate Document action button. For example, Work Order.
            3. Click Buttons, Links, and Actions.
            4. Click Generate Document.
            5. Click Edit.
              The Work Order page.
            6. To add the template ID as a parameter, at the end of the URL, enter &c__templateId=templateobjectId.

              Here's an example.

              &c__templateId=2dt5f0000004C98AAE

              /lightning/cmp/omnistudio__vlocityLWCOmniWrapper?c__target=c:docGenerationSampleFndSingleDocxLwcEnglish&c__layout=lightning&c__tabIcon=custom:custom18&c__TemplateType=MicrosoftWord&c__ObjectId={!WorkOrder.Id}&c__templateId=2dt5f0000004C98AAE
            7. Save your work.
          3. Modify the Omniscript to set default values.
            1. To clone the fndSingleDocxLwc Omniscript, click New Version.
            2. In the PickTemplate step, to hide the Pick a template window during document generation, go to Properties > Conditional View, and then click Show Element if True.

              The Edit Show Hide Rules window opens.

              The Edit Show Hide Rules window.
            3. Enter these values, and then save your changes.
              The Edit Show Hide Rules window.
              • Field: templateId

              • Operator: Equal To

              • Value: blank

            4. In the SetValues step, to preselect the template for document generation, click Edit Properties As JSON and then replace the elementValueMap node with this value.
              "elementValueMap": {
                  "preSelectedTemplate": {
                    "Id": "=%templateId%",
                    "TemplateType": "=%TemplateType%"
                  },
                  "selectedTemplate": "=IF(%templateId% == null, %PickTemplate|1:SelectTemplate|1%, %preSelectedTemplate%)",
                  "templateType": "=%TemplateType%"
                },
              The elementValueMap in the SetValues step.
            5. Click Close JSON Editor.
            6. In the SetGenerationOptions step, click Add New Element Value.

              The Add New Element Value window opens.

            7. Enter these following values, and then save your work.
              The Add New Element Value window.
              • Use Expression For Value: Select the checkbox

              • Element Name: selectedTemplate

              • Expression: IF(%templateId%!=NULL, %preSelectedTemplate%, %selectedTemplate%)

            8. Click Activate Version, and then click Done.
          4. Generate the Microsoft Word .docx document.
            1. On your object, from the Actions dropdown list, click Generate Document .

              The customized fndSingleDocxLwc Omniscript is triggered. The Object ID, and the Template Type fields are populated by default.

              The Enter Object Id page.
            2. Click Next.

              The Pick a template window is hidden.

            3. Select the document generation options, and then click Next.
              The Generation Options page.

              The document is generated.

              The generated document.

              You can download the .pdf and .docx file formats and attach the appropriate object record or email it.

           
          Loading
          Salesforce Help | Article