Generate and export documents from templates

To allow others to generate new documents based on your template, use the Notepad: Template Button widget. You can also optionally enable exporting the resulting documents as a PDF.

Notepad: Template Button widget

After adding the Notepad: Template Button to your Workshop application, select your document template by clicking on + Select and browsing to your file. This will add your template to the Document templates list.

Next, click on the new template entry to open its configuration. First, select a Template Version. If there is no version available, open the template in a new tab and publish a template version. Selecting a version will automatically load the template's required input parameters under Template Inputs.

You can specify a Menu display name for your template when you've added more than one template to your Templates list. If you don't set a display name, the Custom text from the Button display settings will be used.

workshop_notepad_template_button_config

Save options

  • Allow users to choose save location: Users can select their own save location and file name before the document is generated. Any pre-defined Default save location is ignored.
  • Default save name: Defines a default file name for newly generated documents. The value is also used for the PDF file name when Export generated notepad as PDF is set.
  • Default save location: Adjust where new documents are saved. This can be configured by manually selecting a folder or by passing in a Compass RID through a Workshop string variable. By default, a document will be saved in the home folder of the user generating it.

Template inputs

Depending on the template and its version, your Notepad template may consume multiple template inputs. For each of these inputs, link a Workshop variable of the same data type (string, number, date, timestamp, object, or object set) that you would like to use as an input to the template. The current values of these variables will be used to generate your document from the template whenever Notepad: Template Button is selected.

If your input parameter requires a single object, be sure to link it to a Workshop object set variable that contains one object.

On-click options

The on-click options allow you to modify the behavior when a user uses the Notepad: Template Button:

  • Export generated Notepad as PDF: Documents will be automatically downloaded as PDF after they have been generated. By default, the generated Notepad documents won't be persisted in Foundry. Thus, all save options except the Default save name will be ignored.
    • Save Notepad from PDF export: When set, the generated Notepad document used to export to PDF will be saved in Compass as well.
  • Open generated Notepad in new tab: Documents will open in a new tab.

Moreover, you can specify Workshop events or actions that should be executed when a document is created. For example, this can be used to persist the RID of the newly generated document as an object property by using the Created document output variable from the Notepad: Template Button.