Skip to content

Creating Templates

This guide walks through creating a new matter type template from scratch.

Step 1: Create the Folder

In your Templates folder, create a new folder with the matter type name:

Templates/
└── Commercial Lease/          ← New folder

Naming

Use a clear, descriptive name. This is what users will see when selecting a matter type.

Step 2: Create matter.json

Inside your new folder, create a file called matter.json. This defines the form fields.

Basic Structure

{
  "name": "Commercial Lease",
  "description": "Template for commercial lease matters",
  "version": "1.0",
  "blocks": [
    {
      "name": "Client Information",
      "description": "Tenant/lessee details",
      "fields": [
        {
          "key": "client.surname",
          "label": "Surname",
          "type": "text",
          "required": true
        },
        {
          "key": "client.first_name",
          "label": "First Name",
          "type": "text",
          "required": true
        }
      ]
    }
  ],
  "precedents_path": "precedents"
}

Key Elements

Element Description
name Display name for this matter type
description Brief description (shown in UI)
version Template version for your reference
blocks Array of form sections
precedents_path Folder containing document templates

Step 3: Add Form Blocks

Each block is a collapsible section in the form. Add blocks for each logical grouping:

{
  "blocks": [
    {
      "name": "Client Information",
      "description": "Tenant/lessee details",
      "fields": [ ... ]
    },
    {
      "name": "Property Details",
      "description": "Premises being leased",
      "fields": [ ... ]
    },
    {
      "name": "Lease Terms",
      "description": "Term, rent, and conditions",
      "fields": [ ... ],
      "collapsed": true
    }
  ]
}

Collapsed Blocks

Set "collapsed": true for less frequently used sections. Users can expand them when needed.

Step 4: Define Fields

Each field has these properties:

{
  "key": "property.address",
  "label": "Property Address",
  "type": "textarea",
  "required": true,
  "placeholder": "123 Main Street, Sydney NSW 2000",
  "help_text": "Full street address of the premises"
}

Required Properties

Property Description
key Unique identifier, used in documents as {{ key }}
label Display label in the form
type Field type (see below)

Optional Properties

Property Description
required Whether the field must be filled (default: false)
placeholder Example text shown in empty field
help_text Explanatory text shown below the field
default_value Pre-filled value
options For select type, list of choices

Field Types

Type Description Example
text Single line text Name, reference
textarea Multi-line text Address, notes
email Email address Validated format
phone Phone number Validated format
currency Dollar amount Displays formatted
number Numeric value Days, quantities
date Date picker Settlement date
bool Yes/No toggle "GST Applicable"
select Dropdown list Requires options

Full field reference

Step 5: Create Precedents Folder

Create a precedents folder inside your matter type folder:

Commercial Lease/
├── matter.json
└── precedents/              ← Create this folder

Add your document templates here. See Precedent Documents for details on creating templates.

New: Placeholder System

Use the Placeholder System to ensure incomplete documents are never accidentally finalized. Add filters like {{ field | required("Description") }} to display highlighted warnings for missing information.

Template Security

Only use templates from trusted sources. Templates are processed using a sandboxed environment, but you should still only use documents created by your organisation or verified third parties.

Step 6: Test Your Template

  1. Open Certum Draft
  2. Go to Test Templates from the home screen
  3. Select your new matter type
  4. Click Validate to check for issues
  5. Fix any errors and re-validate

Complete Example

Here's a complete matter.json for a simple matter type:

{
  "name": "Commercial Lease",
  "description": "Template for commercial lease matters",
  "version": "1.0",
  "blocks": [
    {
      "name": "Matter Details",
      "description": "Core identifiers",
      "fields": [
        {
          "key": "matter.number",
          "label": "Matter Number",
          "type": "text",
          "required": false,
          "help_text": "Auto-generated if left blank"
        }
      ]
    },
    {
      "name": "Client Information",
      "description": "Tenant/lessee details",
      "fields": [
        {
          "key": "client.surname",
          "label": "Surname",
          "type": "text",
          "required": true
        },
        {
          "key": "client.first_name",
          "label": "First Name",
          "type": "text",
          "required": true
        },
        {
          "key": "client.email",
          "label": "Email",
          "type": "email"
        },
        {
          "key": "client.phone",
          "label": "Phone",
          "type": "phone"
        }
      ]
    },
    {
      "name": "Property Details",
      "description": "Premises being leased",
      "fields": [
        {
          "key": "property.address",
          "label": "Property Address",
          "type": "textarea",
          "required": true,
          "placeholder": "123 Main Street, Sydney NSW 2000"
        },
        {
          "key": "property.area",
          "label": "Floor Area (sqm)",
          "type": "number"
        }
      ]
    },
    {
      "name": "Lease Terms",
      "description": "Term, rent, and conditions",
      "fields": [
        {
          "key": "lease.commencement_date",
          "label": "Commencement Date",
          "type": "date",
          "required": true
        },
        {
          "key": "lease.term_years",
          "label": "Term (years)",
          "type": "number",
          "default_value": "5"
        },
        {
          "key": "lease.annual_rent",
          "label": "Annual Rent",
          "type": "currency",
          "required": true
        },
        {
          "key": "lease.gst_inclusive",
          "label": "GST Inclusive",
          "type": "bool",
          "default_value": "false"
        }
      ]
    },
    {
      "name": "Landlord Details",
      "description": "Lessor information",
      "collapsed": true,
      "fields": [
        {
          "key": "landlord.full_name",
          "label": "Landlord Name",
          "type": "text"
        },
        {
          "key": "landlord.address",
          "label": "Landlord Address",
          "type": "textarea"
        }
      ]
    }
  ],
  "precedents_path": "precedents"
}