•••
 
Documentation   /   Building templates   /   Building your first template
 
 

Building your first template

 

This walkthrough builds a simple offer letter template.

1. Create the template

  1. Go to Toolkit → Templates and click New template.
  2. Choose the document type. For an offer letter that the candidate signs, choose Signable. See Introducing templates and documents for the other types.
  3. Give it a name, choose its business function ("Template is for") and save.

2. Write the text

Type or paste the letter into the editor. Wherever something changes from letter to letter, use a variable:

<p>Dear {{a_counterparty_name}},</p>
<p>We are pleased to offer you the role of {{job_title}} at {{c_entity}},
starting on {{a_date_start}}.</p>
<p>Your salary will be {{salary}} a year.</p>

{{a_counterparty_name}}, {{c_entity}} and {{a_date_start}} are built in. See Document variables. {{job_title}} and {{salary}} are your own variables, which you define next.

3. Define your fields

Open the Variables panel and add a field for each of your own variables. In code, the fields look like this:

--#:
---name:job_title
---type:text
---appears_on:extras
---mini_label:Job title
---required:true

--#:
---name:salary
---type:amount
---appears_on:extras
---mini_label:Annual salary
---string_format:currency
---required:true

Each field appears on the document creation form, in the section named by ---appears_on. See Template fields and the Template field directives reference.

4. Add logic

Add a paragraph only for senior roles:

[[IF=salary(GREATER_THAN £60000)]]
<p>You will be eligible for the senior leadership bonus scheme.</p>
[[ENDIF]]

See Logic statements for every statement.

5. Set up signatures

A Signable document has a signature block for the counterparty and one for your side by default. Use the template settings to name who signs, or define your own signature blocks. See Signature blocks.

To place the signatures somewhere other than the end, put [[SIGNATURE_BLOCK]] where they should go.

6. Test it

Create a document from the template, fill in the form and check the result. Try values that switch each [[IF]] on and off. When you're happy, use the template in a workflow with specific_document or auto_document. See Document actions.

For AI builders

When writing a template:

  • Use built-in variables (a_counterparty_name, a_date_start, c_entity and so on) where they fit, instead of defining new ones.
  • Define every other {{variable}} as a field, or make sure the workflow passes it in ---pass_variables.
  • Give optional variables fallback text, {{variable|fallback}}, or the document can't be locked.
  • Template text is HTML. Wrap paragraphs in <p> and use <h2>/<h3> for headings, <ul>/<ol> for lists and <table> for tables.