Reference Number Template
Docwize administrators can configure a template for generating unique reference numbers. A reference number template combines static text and dynamic fields that pull from a document's metadata — such as doc type, WBS, or discipline — together with an auto-incrementing sequential iterator that ensures no two documents share the same reference number.
Reference number templates are defined within a record template. The Jinja syntax used to build them is accessible via the floating toolbar.
Who configures this
Administrators with access to the New module. Reference number templates are configured from New > Custom Fields & Configuration > Manage Records.
Sample reference number template
DRG-{{document.doc_type}}-{{locations[0].Code}}-STATIC-$DW_SEQ_XXXX$
| Field | Description |
|---|---|
DRG | Static value — appears unchanged on all generated reference numbers. |
{{document.doc_type}} | Dynamic field — replaced with the document's doc type at generation time. |
{{locations[0].Code}} | Dynamic field — replaced with the first location's code. |
STATIC | Static value — appears unchanged on all generated reference numbers. |
$DW_SEQ_XXXX$ | Sequential iterator — generates a unique number for each document. The number of X characters sets the zero-padding width: XXXX produces 0001, XXX produces 001. |
Record Editor
Reference number templates are created within a record template in the Record Editor (accessible from New > Custom Fields & Configuration > Manage Records).
| Field | Description |
|---|---|
| Record Name | The name of the record template. |
| Allowed Groups | Restricts which groups can use this record template. |
| Record Group | Groups this record template with related templates for organisation. |
| New Section Name | The name for a new section within the record (e.g. "Reference Number"). |
| New Section Type | The type of the new section. Select Reference Number to add a reference number field. |
| View Live Preview | Renders a live preview of the record template as currently configured. |
| Save Changes | Saves the record template. |
How to create a reference number template
| Step | Description |
|---|---|
| 1 | Navigate to New > Custom Fields & Configuration > Manage Records. |
| 2 | Click Create New Record. Enter a record name and configure Allowed Groups and Record Group as needed. |
| 3 | Add any metadata fields that will be used as dynamic values in the reference number (e.g. doc type, WBS, discipline). |
| 4 | In New Section Name, enter a name for the reference number field (e.g. "Reference Number"). Under New Section Type, select Reference Number. Click Add to insert the section. |
| 5 | Expand the field's options. In Reference Number Template String, enter the template combining static text, dynamic Jinja fields, and the $DW_SEQ_XXXX$ iterator. Include a dash (-) between elements. |
| 6 | Click Save Changes. |
How to generate a reference number
| Step | Description |
|---|---|
| 1 | Navigate to New and select the relevant record template. |
| 2 | Complete the required metadata fields in the record. |
| 3 | Click Save. The confirmation dialog displays the generated reference number, which can be copied, downloaded, or used to navigate to the document's details. |
What can go wrong
| Issue | Detail |
|---|---|
| Reference numbers not unique | Confirm the $DW_SEQ_XXXX$ iterator is included in the template string. Without it, documents may receive identical reference numbers. |
| Dynamic field returns blank | The metadata field referenced in the template (e.g. {{document.doc_type}}) may not be populated on the document. Ensure the required fields are completed before generating. |
| Template string not saving | Check that the Reference Number section type has been selected and the section added before entering the template string. |
| Wrong zero-padding on sequential number | Adjust the number of X characters in $DW_SEQ_XXXX$ to change padding width. |
Related configuration
- Custom Fields — custom field templates used as dynamic sources for reference number fields
- Floating toolbar — Jinja syntax reference for building template strings