Create a dynamic Word template

Completed

You can create a Word template in Power Apps from two different areas:

  • Advanced settings - Using this requires specific permissions that are available through the System Administrator or System Customizer security roles.

  • From a specific record - When the record is open (main form) or selected in a list (view), those templates are available only for the user who created them. These are called personal templates.

This module focuses on personal templates.

Create a dynamic Word template

To create a Word template based on Dataverse, follow these steps:

  1. Play a model-driven app, select a view of the target table, and then select a specific record from the table by clicking on and selecting the row. Find and select the Word Templates dropdown menu from the Command Bar across the top, and select Download Template. Depending on your browser's window width, you may need to first select on the ellipses in the top Command Bar to find and select Word Templates.

    Screenshot of a sample model-driven app, displaying a list of active accounts and the first record selected. Focus is on the Download Template option of the Word Templates dropdown menu.

  2. In the displayed form, either confirm the pre-selected table or select another table (entity), and indicate if any related records are needed in the template (by using the different relationship options). Select Download to proceed to the next step.

    Screenshot of the Download file to create a template form. Focus is on the Download option.

  3. Open the generated Word template. (It was downloaded onto your local computer, wherever your downloads are saved.) Check the Ribbon across the top for the Developer tab. If the Developer tab isn't in the Ribbon, enable this option from File > Options. Select Customize Ribbon, enable Developer, and then select OK to confirm.

    Screenshot of the Word Options form. Focus is on the Developer option under the Customize Ribbon section and on the OK option.

  4. Define which fields are available for the template. To do so, select XML Mapping Pane from the Developer menu. Select the Custom XML Part that starts with urn:microsoft-crm/document-template/.

    Screenshot of Microsoft Word. Focus is on the XML Mapping Pane on the Developer menu. Focus is also on the Custom XML Part option.

  5. On the XML Mapping pane, right-click each field to add to the document. For each added field, select the field type from the Insert Content Control menu. Available field types are Rich Text, Plain Text, Picture, Checkbox, Combo Box, Dropdown List, or Date picker.

    Screenshot of Microsoft Word. Focus is on the Plain Text and Picture options under the Insert Content Control menu in the XML Mapping pane.

  6. Select, position, and format the fields within the document. A document might resemble the following screenshot.

    Screenshot of the Word template with header and labels added before and after the multiple data fields.

  7. Once the formatted template is ready to be used, save it. Next, upload the saved version to the model-driven app by navigating to the same table view that you previously used to download the Word template. Once in the correct view, select a specific record. Then from the Word Templates dropdown menu, select Upload Template.

    Screenshot of a sample model-driven app, displaying a list of active accounts and the first record selected. Focus is on the Upload Template option of the Word Templates dropdown menu.

  8. A form will pop up; in the form, select Choose File, select the saved template, and then select Upload to proceed.

    Screenshot of the Select file to upload as a template form. Focus is on the Choose File and Upload options.

  9. The template is now available to use for any record you select in the table. (You are not limited to using the template with only the record that you selected to generate the template originally.) To generate a new document for a record using the template, select a record, select the Word templates dropdown menu, and then select the template under the Personal Word Templates section. You can select multiple records, and you will generate a separate document from the template for each selected record.

    Screenshot of the uploaded template option that's available in the Personal Word Templates section of the Word Templates dropdown menu.

The generated document that's uploaded to your local computer is based on the template, but it is populated with the relevant information from the selected record. The following screenshot shows an example of a generated document.

Screenshot of the Microsoft Word document that's generated from the template with header, labels, data from the selected record, and formatting applied.

Next steps

Now, you've learned how to create a Word template that uses Dataverse as a data source to generate standardized documents. Next, you'll learn how to create a work order template.