What is the Generate Document Action?
Generate document fills a template with form data or workflow variables when the workflow reaches the action. For example, a contract can use the approved customer name and date in its text and create one row per line item in a Word table.
Choose a file variable to hold the output. A later step can use that variable to show the file on a task form or archive it in a document library.
Main Features and Business Scenarios of the Generate Document Action in Yeeflow:
Store the Word or PDF templates for contracts, quotes, invoices, or reports in a document library.
Map data to the template’s fields. In Word, content controls can hold individual values or repeat rows from a sub-list.
Keep the original file format or combine selected templates into a single PDF. Store the output in a file variable for the rest of the workflow.
How to Use the Generate Document Action
Prepare the template and identify its data sources before configuring the action. For a contract, decide which workflow fields supply the customer and effective date and which sub-list supplies the line items.
1. Add a Generate Document Action
Open the approval form or list workflow in the workflow designer.
Drag Generate document onto the canvas. Connect it after the steps that collect or set its input values.
Select the action and click the settings icon beneath it.
2. Configure the Generate Document Action
Enter an action name and description. Under Generation type, choose Original file type to keep the template formats or Single PDF file to combine the selected templates into one PDF.
Add Template Files:
In Document template, select Add another template file.
Choose the Application and the document library under Data source, then open Path to select the template file.
For multiple templates, add each file and order them as needed for the output.
How to Upload Template Files to the Document Library:
If the template is not in the library yet, open the library and upload it with New File. For a Word template, set up its content controls before uploading. How to Create Word Templates in the Generate Document Action
3. Set Variables
Click Set variables to link a template’s placeholders to values in the workflow. Open each template in the mapping dialog if you selected more than one.
Regular Variable Mapping:
Select the document template in the mapping window.
Check the Content control to populate and review its Control type. For example, choose a text value for a customer name or the appropriate date value for an effective date.
Under Value, choose the corresponding workflow variable or use the Expression Editor. Select OK to save the mapping. How to Save Workflow Variables to a Word Template
Table Variable Mapping:
Check the Word template’s Table content control and select the workflow sub-list variable under Value.
Select Select fields and map each column’s content control to the matching sub-list field. For a contract, these could be item name, quantity, and amount.
Confirm the field mapping and save the variable mapping. How to save sub list values to word template
4. Configure Output Settings
Enter an Output file name. Use the Expression Editor to include a request reference when each output needs a different name.
In Save output file to, select a file variable, such as Generate File. Later workflow actions can refer to that variable.
To let an assignee open the file from a task form, bind its Attachment control to the same Associated variable. Attachment control
Run a workflow in a test application with sample data that reaches the action. Open the generated file and check its name, format, customer and date fields, and all expected table rows. If the file is linked to a task form, open that task as the intended assignee and check that the attachment is available.
Save to a Document Library (Optional):
Add a Set Data List action after Generate document and connect the two steps.
Set Data source to the destination document library and Execute type to Add.
Under Field Settings, map Name to a business identifier such as the form reference. Map Upload File to the file variable chosen in Save output file to, then select OK.
Run the same test through the archive step. Open the new record in the expected library and check that its identifier and uploaded file match the test request. Add files to a document library folder

