---
schema_version: "1"
id: 5e07bcdcb67f1e498ad99ac42e939222dd974c711300053352782e793679257d
title: Customize the fndSingleDocxLwc Omniscript
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/doc_gen_customize_fndsingledocxlwc_omniscript_394579.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.doc_gen_customize_fndsingledocxlwc_omniscript_394579.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: c080bf106868b60685ed85383bafca01e12b2e3080fd4e8f6b5946a48ef773b9
description: 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.
products:
  - Omnistudio Document Generation
release: "264"
---
# 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](https://help.salesforce.com/s/articleView?id=ind.doc_gen_omniscript_step_properties_394328.htm&release=264.0.0&type=5 "This Omniscript consists of steps, which run sequentially when the Omniscript is invoked. Each step has properties that determine the action the step performs. If you want to change the steps, Salesforce recommends that you either create a new version or clone a copy of this Omniscript.").

To modify the Omniscript, follow these instructions:

1. [Create a custom Generate Document button](https://help.salesforce.com/s/articleView?id=ind.doc_gen_create_a_custom_generate_document_button_394436.htm&release=264.0.0&type=5 "Generate documents from any object such as a contract, order, quote, work order, or opportunity by integrating Omniscript into a custom button. This example uses the fndSingleDocxLwc Omniscript to generate single client-side documents from Microsoft Word .docx or Microsoft PowerPoint .pptx templates."). 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.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-document_generation-264-0-0-production-enus/f76d5573-56ce-4576-b4b2-7a4f1f2e622b/document_generation/images/clm234_customize_fndsingledocxlwc_omniscript_01.png)
    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.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-document_generation-264-0-0-production-enus/f76d5573-56ce-4576-b4b2-7a4f1f2e622b/document_generation/images/clm234_customize_fndsingledocxlwc_omniscript_02.png)
    3. Enter these values, and then save your changes.
        
        ![The Edit Show Hide Rules window.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-document_generation-264-0-0-production-enus/f76d5573-56ce-4576-b4b2-7a4f1f2e622b/document_generation/images/clm234_customize_fndsingledocxlwc_omniscript_02.png)
        
        - 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.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-document_generation-264-0-0-production-enus/f76d5573-56ce-4576-b4b2-7a4f1f2e622b/document_generation/images/clm234_customize_fndsingledocxlwc_omniscript_03.png)
    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.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-document_generation-264-0-0-production-enus/f76d5573-56ce-4576-b4b2-7a4f1f2e622b/document_generation/images/clm234_customize_fndsingledocxlwc_omniscript_04.png)
        
        - 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.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-document_generation-264-0-0-production-enus/f76d5573-56ce-4576-b4b2-7a4f1f2e622b/document_generation/images/clm234_customize_fndsingledocxlwc_omniscript_05.png)
    2. Click **Next**.
        
        The Pick a template window is hidden.
    3. Select the document generation options, and then click **Next**.
        
        ![The Generation Options page.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-document_generation-264-0-0-production-enus/f76d5573-56ce-4576-b4b2-7a4f1f2e622b/document_generation/images/clm234_customize_fndsingledocxlwc_omniscript_06.png)
        
        The document is generated.
        
        ![The generated document.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-document_generation-264-0-0-production-enus/f76d5573-56ce-4576-b4b2-7a4f1f2e622b/document_generation/images/clm234_customize_fndsingledocxlwc_omniscript_07.png)
        
        You can download the .pdf and .docx file formats and attach the appropriate object record or email it.