Skip to main content

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$

FieldDescription
DRGStatic 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.
STATICStatic 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).

FieldDescription
Record NameThe name of the record template.
Allowed GroupsRestricts which groups can use this record template.
Record GroupGroups this record template with related templates for organisation.
New Section NameThe name for a new section within the record (e.g. "Reference Number").
New Section TypeThe type of the new section. Select Reference Number to add a reference number field.
View Live PreviewRenders a live preview of the record template as currently configured.
Save ChangesSaves the record template.

How to create a reference number template

StepDescription
1Navigate to New > Custom Fields & Configuration > Manage Records.
2Click Create New Record. Enter a record name and configure Allowed Groups and Record Group as needed.
3Add any metadata fields that will be used as dynamic values in the reference number (e.g. doc type, WBS, discipline).
4In 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.
5Expand 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.
6Click Save Changes.

How to generate a reference number

StepDescription
1Navigate to New and select the relevant record template.
2Complete the required metadata fields in the record.
3Click 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

IssueDetail
Reference numbers not uniqueConfirm the $DW_SEQ_XXXX$ iterator is included in the template string. Without it, documents may receive identical reference numbers.
Dynamic field returns blankThe 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 savingCheck that the Reference Number section type has been selected and the section added before entering the template string.
Wrong zero-padding on sequential numberAdjust the number of X characters in $DW_SEQ_XXXX$ to change padding width.
  • Custom Fields — custom field templates used as dynamic sources for reference number fields
  • Floating toolbar — Jinja syntax reference for building template strings