Skip to main content
Skip table of contents

Work with Subtemplates

An advanced feature of templates is the ability to embed one or more templates into a principal template. Templates allow you to create templates querying information that you may not be able to easily query from one SOQL Query.

For example, if you wanted to build an Account Summary Template that includes Contact details, Case History and Opportunities, you could create 3 templates, one for each of the objects previously mentioned. Once the templates are created, they can be dropped into a principal template. This allows you to create a document that contains data from all of the objects.

Create a Subtemplate

Before you add a subtemplate to your principal template, you need to create a New Template with the information and formatting you want as a subtemplate. subtemplates are just a template and can contain any of the features of a template. 

Nimble Create is designed to support a two level template tier. So, while a subtemplate can be included within a principal template, a subtemplate cannot be included within another subtemplate that is included in a principal template.

  1. The WHERE clause of your subtemplate should include the same filter parameters (:param1) that will be passed in from the Principal template.

  2. Any fields referenced in the WHERE clause of the subtemplate must also be in the SELECT line of the principal template.

  3. Ensure you preview your subtemplate before you try to add it to the principal template. This will help to identify any issues with the template so they can be corrected before the subtemplate is added to the principal template.

Insert a Subtemplate in a Principal Template

Once your subtemplate is created and you have confirmed that it’s working as expected, you can add the subtemplate to the principal template.

  1. In the Templates tab, find your principal template and click Edit

    Note: If your principal template has not yet been created, create a new template.
  2. Once you are viewing your principal template, click Edit Template.

  3. From TemplateBuilder, click where you want to insert the subtemplate and click


  4. In subtemplate Properties, populate the following fields:

    1. In Name, enter the name of the subtemplate
    2. In Template Id, leave this field blank.
    3. In Parameters, enter the parameters to be passed into the template. 
      The format of this each parameter must be: param1={!SObject.MergeFieldHere} and multiple parameters must be separated with an ampersand with no spaces. For example: param1={!Account.Id}&param2={!Account.Name}.

  5. Click OK. Template Builder now includes your subtemplate.

  6. Click Save.

  7. Preview the principal template to ensure it is working as expected. If the preview is not working, check the Template Name and Parameters from the subtemplate to ensure they are accurate.

Each template can have up to nine parameters. The parameters from the principal template do not automatically pass through to the subtemplate, so you must specify them explicitly.

Example of Passing a Parameter to a Subtemplate

The principal template has:

param1=0015000001AsWVQ, an Account Id, and

param2=a035000000SvUPr, an Order Id

The principal template has a SOQL query:


FROM Account

WHERE Id = :param1

The principal template specifies a subtemplate with the following pass-through parameters: param1={!Account.Id}

param2 is not used in this example, and doesn’t get passed along to the subtemplate

The subtemplate will be constructed as follows: param1=0015000001AsWVQ, an Account Id from the principal template

The subtemplate has a SOQL query:

SELECT Id, Name, NU__StartDate__c, NU__EndDate__c,NU__MembershipType__c

FROM NU__Membership__c

WHERE NU__Account__c = :param1

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.