# Client Matter — Auto-numbering

Auto-numbering assigns a ClientCode or MatterCode automatically when none is provided in the input. It is activated per code type by setting the corresponding start number in the configuration.

# Configuration properties

All properties live under SharepointCfg (the per-environment configuration).

Property Type Description
ClientCodeStartNumber int? Counter seed for client codes. Leave empty (not 0) to disable auto-numbering for clients.
ClientCodeNumberFormat string Format string for the generated client code (see Format strings).
ClientCodeNumberNoReset bool When true, the counter never resets between format prefixes (e.g. never resets per year). Default: false.
MatterCodeStartNumber int? Counter seed for matter codes. Leave empty to disable.
MatterCodeNumberFormat string Format string for the generated matter code.
MatterCodeNumberNoReset bool When true, the counter never resets. Default: false.

# When it runs

Auto-numbering runs in step 6 of the execution flow. It activates for each code independently:

  • ClientCode is auto-assigned when ClientCodeStartNumber is configured and no ClientCode was supplied in the request.
  • MatterCode is auto-assigned when MatterCodeStartNumber is configured and no MatterCode was supplied.

If either code is auto-assigned and the request was loaded from a JSON file, the file is overwritten with the assigned values so the source record reflects what was actually used.

# Format strings

The format string controls how the numeric counter is rendered into a code. Several substitutions are applied in order:

# Number placeholder (#)

# characters are replaced by the counter value. The number of # characters controls zero-padding:

Format Counter = 5 Counter = 42
# 5 42
#### 0005 0042
yyyy-#### 2026-0005 2026-0042

# Year substitution

yyyy is replaced with the 4-digit current year; yy with the 2-digit year. Substitution is case-insensitive.

# Dynamic expressions

The format string is also evaluated as a dynamic name expression against the matter's properties before year substitution runs. This allows codes to embed matter properties, for example:

  • {MatterType}-####TAX-0001
  • {ClientCode}-####32211-0001

See Dynamic Name for the full expression syntax.

# Counter storage

Each configuration (SharepointCfg.Name) has its own counter store, saved as a JSON file under the service's Numbers/ folder. The file is loaded into memory on first use and written back after every increment. All access is serialized with a process-wide lock, so concurrent requests never receive the same number.

The counter state is a flat dictionary of field → last-issued-number. The key used for a given code depends on the resolved format prefix and the NoReset flag (see Counter reset behaviour below).

# Counter reset behaviour

When the format string contains a variable prefix — such as a year — the counter can either reset when the prefix changes or continue from where it left off. This is controlled by NoReset.

NoReset = false (default): after the format is resolved, the non-# portion of the format (the prefix) is extracted and appended to the counter key. The counter therefore resets to the start number each time the prefix changes.

Example with MatterCodeNumberFormat = "yyyy-####":

Year Counter key First issued Second issued
2025 MatterCode_2025 2025-0001 2025-0002
2026 MatterCode_2026 2026-0001 2026-0002

NoReset = true: the counter key is always just the field name (ClientCode or MatterCode), regardless of the format prefix. The counter never resets.

Example with MatterCodeNumberFormat = "yyyy-####" and NoReset = true:

Year Counter key Issued codes
2025 MatterCode 2025-0001, 2025-0002, …
2026 MatterCode 2026-0099, 2026-0100, … (continues from 2025)
Last Updated: 4/23/2026, 10:40:37 AM