Attach Template Field

A sub-template can be generated as a separate document for a super-template by a field of the general form:
{
Attach Template
template-name
DocTitle
title-expression
With
variable-1
As
expression-1
,
...
,
variable-K
As
expression-K
}
where the
DocTitle
component is optional and the
With
component is optional.
Variables used in the sub-template contribute to relevance in the overall questionnaire as though the body of the sub-template occurred at the location of the attach field in the super-template, even though the document corresponding to the sub-template is actually generated as a separate attachment.
This means suites of documents that need to be generated together can do so from the one questionnaire. The answers to the questions will be reused throughout the documents and the final page of the questionnaire will contain links to multiple documents depending on how many are generated. By default the
Attach template
field will generate the sub-template as a document in the document format specified in the profile for the
Writable format
(for users who can view the writable version of the document). The
Attach template
field can generate the sub-template as a read-only document by using the following:
{
Attach
Locked
Template
template-name
DocTitle
title-expression
With
variable-1
As
expression-1
,
...
,
variable-K
As
expression-K
}
where again, the
DocTitle
component is optional and the
With
component is optional. The read-only format of the document from the sub-template is determined by the profile under the
Read-only format
setting.

Example 1

Let's imagine a technology company needs to produce a Non-Disclosure Agreement with all their new Sales Agreements. Common variables such as NameBuyer and NameSeller are used in both documents so they only have to be asked once to populate both documents. The Attach field would look like this - where NDA is the template name of the Non-Disclosure Agreement listed under its Template Properties:
{Attach Template NDA}
Or to generate a read-only NDA for all users:
{Attach Locked Template NDA}

Example 2

This time along with the Non-Disclosure Agreement being attached to the Sales Agreement document, there is optionally a Work Order Form detailing extra services and a software license agreement. These are surrounded in a conditional span with a simple Business Rule so the user can choose which other documents should also be attached:
{Attach Template NDA}
[
AddWorkOrderForm
{Attach Template WORK_ORDER_FORM}]
[
SLANeeded
{Attach Template SLA}]

Example 3

The name of the attached document can also be changed on generation. This may be because you are attaching the same document more than once for different reasons, or it can be based on the answer to a question as is done here for the Work order form template and the DescriptionofWork variable:
[
AddWorkOrderForm
{Attach Template WORK_ORDER_FORM DocTitle "Work Order for " +DescriptionOfWork + " Services"}]

Example 4

In this example, the NDA template has been made generic so that it can be generated alongside a number of different documents. This means it has generic variable names, so we must pass in the names of the NameBuyer and NameSeller variables from the Sales Agreement and map them to the generic equivalent ones in the NDA:
{Attach Template NDA With NameOtherParty As NameBuyer, CompanyEntity As NameSeller}
And then use the same NDA template when generating an OEM agreement instead:
{Attach Template NDA With NameOtherParty As PartnerName, CompanyEntity As NameSeller}

Example 5

Finally, let us extend example 3 above. Perhaps the technology company's customer might want quotes for multiple projects up front. A Work Order Form for each must be produced to detail this work and its milestones. We can then repeatedly attach the Work Order Form template and change the name of each generated document accordingly for each project:
[
Repeat NumberOfProjects
{Attach Template WORK_ORDER_FORM DocTitle "Work Order Form for " + ProjectName}]