Traceability and Serialization

Updated Mar 28, 2026
DataMagik Automate

Manufacturing & Traceability Guide

Manage serial number series, generate traceable identifiers, and track manufacturing data with full audit capabilities.

Table of Contents

  1. Overview
  2. Understanding Serial Number Series
  3. Creating a Series
  4. Format String Tokens
  5. Base Types & Encoding
  6. Reset Rules
  7. Generating Serial Numbers
  8. Records & Tracking
  9. Script Engine Integration
  10. Best Practices

1. Overview

The Traceability Management system provides enterprise-grade serial number generation and tracking for manufacturing environments. It supports:

  • Configurable Formats — Build serial numbers with date tokens, sequences, and custom prefixes
  • Multiple Base Types — Numeric, alphanumeric, hexadecimal, or alpha-only encoding
  • Automatic Reset — Reset sequences daily, weekly, monthly, yearly, or per shift
  • Global Uniqueness — Enforce company-wide uniqueness across all series
  • Full Audit Trail — Track when, where, and why each serial was generated
  • High Capacity — Support billions of unique identifiers per series

Use Cases: Product serial numbers, batch/lot identifiers, work order numbers, document numbers, asset tags, shipping labels.

2. Understanding Serial Number Series

A Series defines how serial numbers are formatted and generated.

ComponentDescription
NameHuman-readable identifier
Format StringTemplate with tokens for building serial numbers
Base TypeNumeric, alphanumeric, hex, or alpha encoding
Reset RuleWhen to reset the sequence counter
Current ValueThe last sequence number used
IncrementHow much to increase sequence each time
Min LengthMinimum digits/characters for sequence portion
GlobalWhether to enforce company-wide uniqueness

3. Creating a Series

Step 1: Open Traceability Management

Navigate to Manufacturing → Traceability.

Step 2: Click "Add Series"

Step 3: Configure the Series

Basic Settings:

FieldDescriptionExample
Series NameDescriptive nameProduct Serial Numbers
Format StringTemplate with tokensSN-{YYYY}{JJJ}-{####}

Sequence Settings:

FieldDescriptionDefault
Starting ValueFirst sequence number0
Increment ByStep between numbers1
Min LengthMinimum sequence digits4

Advanced Settings:

FieldDescription
Base TypeEncoding system (see Section 5)
Reset RuleWhen to reset (see Section 6)
Global SeriesCompany-wide uniqueness check

Step 4: Preview and Create

The live preview shows what generated serials will look like. Click Create Series when ready.

4. Format String Tokens

Build your serial number format using these tokens:

Date & Time Tokens

TokenDescriptionExample
{YYYY}4-digit year2025
{YY}2-digit year25
{MM}Month (01-12)06
{DD}Day (01-31)15
{JJJ}Julian day (001-366)166
{WW}Week of year (01-53)24
{HH}Hour (00-23)14
{NN}Minutes (00-59)30
{SS}Seconds (00-59)45

Sequence Tokens

TokenDescriptionExample
{SEQUENCE}Sequence number0042
{####}Sequence (alias)0042

Context Tokens

TokenDescription
{SHIFT}Current shift (A/B/C)
{LINE}Production line
{PLANT}Plant/facility code
{BATCH}Batch identifier
{PART}Part number

Format String Examples

FormatResultUse Case
SN-{YYYY}{JJJ}-{####}SN-2025166-0042Standard product serial
{YY}{MM}{DD}{SHIFT}-{SEQUENCE}250615B-00123Date-stamped with shift
P{YY}{WW}-{####}P2524-001AAlphanumeric compact
LOT-{YYYY}{MM}{DD}-{LINE}-{####}LOT-20250615-L1-0001Manufacturing batch

5. Base Types & Encoding

Choose how the sequence portion is encoded:

Numeric (Default)

PropertyValue
Characters0-9
Capacity (4 digits)10,000
Example0001, 0042, 9999
Best forStandard serial numbers, traditional systems

Alphanumeric (Base36)

PropertyValue
Characters0-9, A-Z
Capacity (4 digits)1,679,616
Example0001, 00A1, ZZZZ
Best forHigh-volume, compact identifiers

Hexadecimal (Base16)

PropertyValue
Characters0-9, A-F
Capacity (4 digits)65,536
Example0001, 00FF, FFFF
Best forSystems expecting hex values, electronics

Alpha Only (Base26)

PropertyValue
CharactersA-Z
Capacity (4 digits)456,976
ExampleAAAA, ABCD, ZZZZ
Best forLetter-only requirements

Capacity Comparison

Base Type4 Chars6 Chars8 Chars
Numeric10K1M100M
Alphanumeric1.7M2.2B2.8T
Hexadecimal65K16.8M4.3B
Alpha Only457K309M209B

6. Reset Rules

Control when the sequence counter resets to the starting value.

RuleDescriptionBest For
Never (Default)Sequence continues indefinitelyProduct serials that must always be unique
DailyResets at midnightDaily batch numbers, shift logs
WeeklyResets Monday at midnightWeekly production batches
MonthlyResets on the 1st of each monthMonthly document numbering
YearlyResets on January 1stAnnual numbering schemes
Per ShiftResets at each shift changeShift-specific tracking

Example with Daily Reset:

  • Day 1: 0001, 0002, 0003
  • Day 2: 0001, 0002, 0003

7. Generating Serial Numbers

From the UI

  1. Open a series in Traceability Management
  2. Click Generate
  3. Optionally enter work order and quantity
  4. Click Generate Serials

From Scripts

Use the serial object in the Script Engine:

function main(context) {
  // Generate single serial
  const sn = serial.next("ProductSerials", {
    plant: "DET",
    line: "L1"
  });
  
  // Batch generate
  const serials = serial.batch("PartSerial", 5, {
    line: "L1"
  });
  
  // Preview without consuming
  const preview = serial.preview("ProductSerials");
  
  // Get series info
  const info = serial.info("ProductSerials");
  
  return {
    success: true,
    data: { serial: sn, batch: serials }
  };
}

From Document Templates

Serial numbers can be generated during document generation by calling serial functions in the script that triggers generation.

8. Records & Tracking

Every generated serial number is recorded with full context for traceability.

Record Fields

FieldDescription
Serial NumberThe generated serial
SeriesWhich series generated it
Work OrderAssociated work order (if provided)
Generated AtTimestamp of generation
Generated ByUser who triggered generation
Context DataPlant, line, shift, and other context tokens

Searching Records

Search for serial numbers by:

  • Serial number (exact or partial match)
  • Series name
  • Work order
  • Date range

Record Metadata

View metadata about generated serials including generation statistics and series utilization.

9. Script Engine Integration

The Script Engine provides full access to the traceability system.

Available Methods

MethodDescription
serial.next(series, [context])Generate next serial (increments counter)
serial.preview(series, [context])Preview next serial (no increment)
serial.info(series)Get series details (format, counter, etc.)
serial.batch(series, count, [context])Generate multiple serials atomically
serial.list()List all available series

Label Printing with Serials

function main(context) {
  // Generate serial
  const sn = serial.next("PartSerials");
  
  // Create ZPL label with serial
  const zplCode = zpl.fromTemplate("SerialLabel", {
    serialNumber: sn,
    partNumber: context.partNumber,
    barcode: sn
  });
  
  // Print the label
  manufacturing.printLabel(context.printer, zplCode);
  
  return { success: true, data: { serial: sn } };
}

Serial + Document Generation

function main(context) {
  // Get product info from UDT
  const product = tables.get("products", context.productId);
  
  // Get the correct serial series for this product
  const seriesName = product.value.serialSeries || "DefaultSerials";
  
  // Generate serial
  const sn = serial.next(seriesName, {
    partNumber: product.value.partNumber,
    workOrder: context.workOrder
  });
  
  // Generate certificate document
  documents.generate("Product Certificate", {
    serialNumber: sn,
    product: product.value,
    manufactureDate: new Date().toISOString(),
    workOrder: context.workOrder
  });
  
  return { success: true };
}

10. Best Practices

Format Design

  • Include date tokens — Makes serials self-documenting
  • Use Julian day for compactness{JJJ} instead of {MM}{DD}
  • Match industry standards — Some industries have specific requirements
  • Plan for capacity — Consider future growth when setting min length

Series Organization

  • One series per use case — Don't mix product serials with document numbers
  • Descriptive names — "Product Serial - Widget A" not "Series 1"
  • Document purpose — Record what each series is for

Global vs. Local Uniqueness

Use Global WhenUse Local When
Serials must be unique across your entire companySerials are part-specific
Multiple series might generate similar formatsDifferent series have clearly different formats
Regulatory compliance requires absolute uniquenessPerformance is critical (local checks are faster)

Reset Rule Selection

Use CaseRecommended Reset
Product serialsNever
Daily production logsDaily
Weekly batch numbersWeekly
Invoice numbersNever or Yearly
Shift labelsPer Shift

Capacity Planning

  • Calculate annual volume — How many serials per year?
  • Add safety margin — Plan for 3-5x expected volume
  • Consider format lifespan — Will this format last 10+ years?
  • Test with high volumes — Verify performance at scale
Was this page helpful?