Add document generation action to page

Document generation actions allow you to quickly generate a document from a page, all without needing to manually input any information into the document. One of the most common ways to utilize the Document connection is to add a button to a page that a user can click on and generate a document.

However, adding a button is only one part of the process. In order to fully set up a document generate action you need to do the following:

  • Create a form, or use an existing form, and add a Documents connection.

  • Create a new action flow using one of the document actions.

Before adding a new action to a page, it is important to understand the different actions and their associated behavior. You will also need to have an existing document package created that contains an uploaded document with tags placed in from the Tagger.

The following scenario walks you through adding a button to a page and then creating a new action flow based on the Click interaction using the Generate Document action type.

Scenario - Add a document generate button to a form and create a document generation action

The most common action type to use when generating a document is the Generate Document action type. This action type is good for simple document creation, but also allows for a lot of customization when it comes to how a document behaves once the generation process completes. The Generate Document action type is useful for generating documents around proposals, contracts, and NDAs just to name a few use cases.

In the following scenario we will look at adding a "Generate Document" button to a page using the apps page designer.

This scenario is assuming the following:

1. Add Generate Document button to form

  1. Open an existing app or create a new app using the page designer.

  2. Once the forms designer page loads, select the Components option.

  3. From the components list, locate the Button Set component. Left-click drag the Button Set option to the desired point on the page.

    Note: If intending to use a model or connected data source ensure that the button set is referencing the correct model. This can be done by selecting the button set added and checking the Model field. In this case you want to make sure the model select is the model that contains the UI fields that the Generate document action is going to be referencing for the available tags.

  4. Once the button has been added, the General settings tab for the button displays.

  5. In the Button Label field type in the desired name of the button.

    In this example we are going to call the button "Generate Document".

  6. Click Save to save the form.

  7. Expand the Interactions menu and click Add.

  8. In the pop-up window select Add action flow.

  9. In the pop-up window click Create new action flow.

2. Create new action using Generate Document action type

  1. In the Create action flow window, name the action flow (required) and provide a description of the action (optional). In this example we are going to call this "Generate & Download".

  2. Click Create to complete the process.

  3. Once the action has been created, the Action flow designer window shows a flow based on a click action.

  4. Under the Click action, click the + icon to add a new action.

  5. In the Select an action window, select Document to display all of the action types related to document generation.

  6. Select the Generate Document action.

    This adds the Document action "Generate document" action to the flow.

  7. Select the Document action box to display the Settings related to that action. We need to configure different settings here in order to connect this action to an existing document package.

3. Set up the Document action

  1. In the Settings menu we need to configure the following options:

    1. Action - The document action you selected displays in this field automatically and does not need to be selected.

    2. Behavior - Select Wait and download.

    3. Package - Select the document package that needs to be associated with this action. This option is going to determine what document is used when the you or the document generator clicks the "Generate Document" button.

    Note: If the document package you created does not display in the list, save the page and then refresh your browser.

  2. Once you select a document package, each of the Tags that have been added to the document package display under the Package field.

    1. This is going to show you each Tag and you can set the associated field that needs to be used to display the data.

      Note: It is important to note that fields such as Dates, Times, Currencies, and Numbers need to be formatted through the tags placed in the document.

    2. For example, if you have a field on the page called Asset Type, and you added the Asset Type tag to your document, you can use Merge Syntax to add the data into the document dynamically.

      In this example, the Asset Type is a UI field coming from the UI-Only model and the Id associated with that field is AssetType. In order to use merge syntax here you would type "{{AssetType}}"

  3. After setting the fields for each tag, click Save to save the form.

4. Preview the page and generate the document

To test that the action and button is set up correctly you can test the page.

  1. Click Preview.

  2. Once the page loads, click the Generate Document button.

  3. The document then is generated based on the document package selected. Depending on the size of the document and the scope of the action flow, you may need to wait around 20 seconds for the process to complete.

  4. Open the downloaded document and check to see if the tags are now displaying information based on the form the document was generated from.