Using the HotDocs handler on a Webform and linking to the generated document
Adding a HotDocs handler to a Webform takes a couple steps, including a hidden field that needs to be added to the Webform.
Webform handler
Navigate to the Settings → Emails/Handlers section of a Webform, then add a HotDocs handler. After doing so, you’ll need to add a template package ID for the HotDocs document that should receive the field mappings. The template package ID can be found in your HotDocs account by navigating to Manage templates, then copying the alphanumeric ID at the end of the URL of the template being used.
After adding the template package ID, save the Webform handler, then edit it again. The handler should call HotDocs’s REST API to obtain the template’s fields, listing them within a Document variables fieldset, followed by a select field for each field in the Webform. Each select field’s options will contain the HotDocs template’s variables, establishing the mappings between the Webform fields and HotDocs template variables. For Webform composite fields like addresses or names, either the full variable or a part of it (e.g. an Address field’s city) can be mapped to a HotDocs variable.
Linking to a download of the HotDocs document
As indicated in a note at the bottom of the handler’s configuration form, you will need to add a Value field to the Webform whose value is a token based on the machine name of the handler ([webform:handler:HANDLER_MACHINE_NAME:completed:document_id]). This will store the ID of the HotDocs-generated document within the Webform.
Then, to include a link to download the HotDocs-generated document, such as on the Webform’s confirmation page, add a link pointing to the URL /download-document/ followed by a Webform submission data token that uses the machine name of the previously created Value field. For example: <a href="/download-document/[webform_submission:values:MACHINE_NAME]" class="button">Download document</a>
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion