Advanced document generation

Beyond using a button to generate a document from a page, there is more customization you can do to further enhance the document generation experience.

For example, you can use block messages to provide more detailed information to the document generator, and even provide more detailed error messages should an issue arise during document generation. Most of these advanced features come down to your understanding of how to build an app in the page designer, but there are some more advanced features that apply to document generation.

In this section we will walk through a few examples of some of the more advanced document generation features.

Scenario - Use the Download action to create a "document history table"

This scenario walks through creating a document "download center" to display a list of documents that have been previously generated. In this example we are going to be using the DocGen Instance (List) object model to display a table with a list of documents that have been generated that can then be downloaded using the Download action.

This scenario assumes the following:

1. Add data models and table to the page

  1. Use an existing page or create a new page using the apps page designer.

  2. Open the Models tab.

  3. Click the + icon to add a new model.

  4. Name the model "DocumentTable".

    Note: You can name the model whatever you want for your own reference. In this example we are going to call the model "DocumentTable".

  5. In the Connections field, select Documents.

  6. In Object field, select DocGen Instance (List). Click OK to close the window.

    This adds the following data object fields:

    1. Id

    2. endDate

    3. startDate

    4. packageName

    5. status

  7. Return to the page designer, and select the Components tab.

  8. Add a table to the page using the Table component.

  9. In the table settings window, locate the Models field. In the Models field, select the model created. In this case we are going to select DocumentTable.

  10. Click the Add fields drop-down and select Model fields.

  11. In the Model fields window click the + icon next to each field reference in Step 6a. This adds each of the data model fields to the table.

    Note: If the fields do not display click Display all object fields.

  12. In the Add feature drop-down menu select Row action. This is going to add the Run action button to the table.

  13. Select the Run action button and change the label to "Download".

  14. Click Save to save the page.

2. Add Download Document action

  1. Click the Action flows tab.

  2. In the Action flows menu, click the + icon.

  3. In the Name field, type "Download Document". Click Create.

  4. In the Download Document action flow screen click Add Input.

  5. In the Instance field we need to type in the name of the model we created in Step 1.4. In this instance we are going to type in "DocumentTable".

  6. In the Action flow screen click the + icon.

  7. Select the Documents connection, and then select the Download Document action. This is going to add the Download Document action to the flow.

  8. In the Download Document settings name the action Download Document.

  9. In the Instance field we need to reference the Model field that will help identify the document to download. In this instance we are going to use the id field. Type in the following: "{{id}}".

  10. Click Save to save your progress.

3. Create Download run action

  1. Return to the page designer, and select the Download button.

  2. Expand the Interactions menu, and click Add.

  3. In the drop-down menu select Add action flow. This creates the Run action bound to the table component and opens the Action flows menu. You can see the new action under the Component Bound section.

  4. In the Run action flow click the + icon.

  5. Select Core actions, and search for "Run action flow".

  6. Select the Run action flow option under the Logic section.

  7. In the Run action Settings menu click the Action flow drop-down and select Download Document. This is referencing the Download action flow created in Step 2: Create the download action flow.

  8. Click Save to save the page.