Skip to main content

Reference Number Template

Users 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.

A reference number template can be created as a standalone, reusable, named template via New > New Reference Number, or written directly into a record's Reference Number Generation section. The Jinja syntax used to build them is accessible via the floating toolbar.

Who configures this

Users with access to the New module. Reusable templates are managed from New > New Reference Number; templates used within a record are configured from New > Custom Fields & Configuration > Manage Records.

Creating a reusable reference number template

New > New Reference Number opens the Generate New Reference Number dialog, which manages a list of named, reusable reference number templates independently of any single record.

ControlDescription
TemplateDropdown listing saved reference number templates.
AddOpens the Add Jinja Template dialog to create a new template.
EditOpens the selected template in the Add Jinja Template dialog for editing. Disabled until a template is selected.
DeleteRemoves the selected template. Disabled until a template is selected.

Clicking Add (or Edit on an existing template) opens the Add Jinja Template dialog:

FieldDescription
Template NameThe name the template is saved and listed under.
Template String (Jinja)The template string — static text, dynamic Jinja fields, and the $DW_SEQ_XXXXX$ sequential iterator, using the same syntax as the sample below.

How to create a reusable reference number template

StepDescription
1Navigate to New > New Reference Number.
2Click Add.
3Enter a Template Name.
4Enter the Template String (Jinja), combining static text, dynamic Jinja fields, and the $DW_SEQ_XXXXX$ iterator.
5Click Create.

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

A reference number field is added to a record template via a Reference Number section in the Record Editor (accessible from New > Custom Fields & Configuration > Manage Records).

Edit Record dialog showing a Reference Number Generation section alongside a record's other sections

Edit Record — a Reference Number section alongside a record's other sections

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 Generation").
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.

Expanding a Reference Number section reveals two ways to supply the template — pick a saved one, or write it directly:

Reference Number Generation section expanded, showing the Existing Reference Number Templates dropdown and Reference Number Template String field

Reference Number Generation section — expanded

FieldDescription
Existing Reference Number TemplatesSelects a template created via New > New Reference Number.
Reference Number Template StringThe template string — static text, dynamic Jinja fields, and the $DW_SEQ_XXXX$ iterator — written directly for this record, whether or not an existing template is also selected above.
Existing Reference Number Templates dropdown open, listing saved templates

Existing Reference Number Templates — dropdown open

How to add reference number generation to a record

StepDescription
1Navigate to New > Custom Fields & Configuration > Manage Records.
2Click Create New Record (or the pencil icon on an existing 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 Generation"). Under New Section Type, select Reference Number. Click Add to insert the section.
5Expand the section's options. Either select a saved template from Existing Reference Number Templates, or enter a template directly in Reference Number Template String, 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.

Troubleshooting

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.
Existing Reference Number Templates dropdown is emptyNo reusable templates have been created yet. Create one via New > New Reference Number first.
  • Custom Fields — custom field templates used as dynamic sources for reference number fields
  • Floating toolbar — Jinja syntax reference for building template strings