Skip to main content

How to save workflow variables to word template

Map approval form variables to Word content controls, choose Word or PDF output, and verify the generated file.

Use Generate Document to fill a Word template from an approval workflow. Set up the form variables, add matching content controls to the template, then configure where the finished file will be available.


Business Scenarios

Use one template for documents that share a layout, such as contracts, purchase orders, or project summaries. For example, an approved contractor request can fill in the client name, expense, date, and signature in a contract template.


Prerequisites

  1. Approval form. Create the form and configure the variables you want to use. For a contract, prepare text for the client name, a date value, and an image value for the signature. Check that each value exists before the workflow reaches Generate Document. Create an approval form · Design the submission form

  2. Word template. In desktop Word, open the Developer tab and insert a content control at each place that needs a value. Use Plain Text for names, Rich Text for styled text, and Picture for an image. In each control’s Properties, enter a recognizable Title and Tag. For example, use Client Name for both, then select the actual workflow variable in the mapping step. Save the file as .docx and upload it to the document library you will use in the workflow. Create a Word template


How to Save Approval Form Workflow Variables to a Word Template

  1. Add Generate Document to the workflow. Under Document template, choose the application and document library that contain your .docx file, then select the file. Generate document action

  2. Open Set variables → Settings. Check the Content control rows you want to populate, confirm each Control type, and choose the matching workflow variable under Value. Use the expression editor when you need to format or combine values. In the example, Client Name is text, Signature is a picture, and Date is mapped to a text control. For a date shown as text, check the rendered date format.

Word mapping example for Client Name and Date as text and Signature as a picture bound to signature8.

Choose Original file types to keep the Word format or Single PDF file to generate a PDF. Enter the Output file name and select a file variable or attachment destination in Save output file to. To display the file on a later task form, link that form’s file control to the same output variable. For a table with repeating rows, map a Sub List separately. Map Sub List values to a Word template

Publish the workflow in a test application and submit a sample request containing a date and a test image. Open its generated file and check the text, date format, and image. From a requester or assignee account permitted to read the file, check it opens from the intended form or task. If a field is blank, check the variable’s value at the document step and the corresponding content control mapping.

Did this answer your question?