ASSEMBLE Instruction

The ASSEMBLE instruction adds a template you specify to the assembly queue.

The ASSEMBLE instruction model is only available in Component Studio when you are creating a computation or directly in a template using the field editor.

Unlike the INSERT instruction, which adds the content of a specified template into the assembled document when HotDocs encounters the instruction, the ASSEMBLE instruction tells HotDocs to wait until it finishes processing the current template to process the specified template.

It is best practice when working with ASSEMBLE instructions to include them in the template and in the interview (if you're using a custom interview). This is because when HotDocs assembles a document, it runs two scripts:

Each time HotDocs processes one of these scripts, it first removes any templates that were added by ASSEMBLE instructions in the current template. Then, as HotDocs encounters each ASSEMBLE instruction, it adds that template to the assembly queue. Thus, if the ASSEMBLE instructions in your interview script do not match the instructions in the template script a number of problems arise; for example, templates added to the assembly queue from the template script are removed and not replaced when HotDocs runs the interview script. If you aren't using a custom interview, your template script and interview script are the same so this is not applicable.

Instruction name Model After you drag and drop the model into the script tab:
ASSEMBLE ASSEMBLE "File name" Replace "File name" with the template you want HotDocs to add to the assembly queue.

Example

A template author is creating a template for resumes and they want to check if the template user also wants to assemble a cover letter. In the interview they add a True/False variable called CoverLetterRequired which asks the template user: "Do you also want to create a cover letter?".

In the template, the template author uses the Field Editor to add the following instructions to the template:

[IF CoverLetterRequired]

[ASSEMBLE "CoverLetter.docx"]

[END IF]

The IF instruction first checks if the template user answers "Yes" to the CoverLetterRequired True/False variable. If they have, then the ASSEMBLE instruction adds the template CoverLetter.docx to the assembly queue. The END IF instruction closes the conditional region. Once HotDocs completes the assembly of the resume template, it begins assembling the "CoverLetter.docx".

Download

After you download the example template, you can import the template to any workspace to see this example code in action.