Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.affzero.com/llms.txt

Use this file to discover all available pages before exploring further.

What it does

The Generate Invoice Number step uses AI to analyze your invoice number pattern and generate the next number in a local, per-automation sequence. It understands common formats — sequential numbers, year-based prefixes, zero-padded series, alphanumeric formats — and continues the pattern automatically. The step produces one variable (the next invoice number) that you can use in Create Invoice steps, email bodies, or any downstream step.
Using the global sequence instead? For most users the better option is to configure the global Invoice Numbering setting under Invoices → Invoice Numbering. That makes {invoice_number_global} available automatically inside every Create Invoice step — no separate numbering step needed. Use this step when you need a secondary or automation-specific sequence alongside the global one.

Global vs Local — What’s the difference?

This step (local)Global sequence
Variable{invoice_number_local} (default, customisable){invoice_number_global}
ScopeThis automation onlyAll automations
Configured inThis step’s configInvoices → Invoice Numbering
When generatedWhen this step runsInside the Create Invoice step
The two sequences are completely independent — both can be active in the same automation without interfering with each other.

When to use it

  • You need a separate invoice sequence for a specific automation (e.g. a different prefix for advertiser billing vs affiliate billing)
  • You want the sequence to be entirely self-contained within one automation
  • You already have a global sequence configured but need an additional series for this workflow

Configuration

Examples

Paste 2 to 4 recent invoice numbers from your own records. The AI analyzes the pattern from these examples. Example inputs:
If your format is…Enter examples like…
Simple sequentialINV-001, INV-002, INV-003
Year + sequenceINV-2026-001, INV-2026-002
Year + zero-padded2026-0045, 2026-0046, 2026-0047
Custom prefixACME/2026/0010, ACME/2026/0011

Pattern Description (optional)

Add a plain-English description of the pattern for extra clarity, especially for complex formats:
Year followed by a 4-digit zero-padded sequence. Resets to 0001 on January 1st each year.

Regex (optional)

If you need the generated number to match a specific format exactly, enter a regex pattern:
INV-\d{4}-\d{3}
The AI will ensure its output matches this regex.

Variable Name

The name used for the generated number variable. Defaults to invoice_number_local. You can change it if you have multiple Generate Invoice Number steps in one automation (e.g. invoice_number_affiliate, invoice_number_advertiser). The variable will be available as {invoice_number_local} (or your custom name) in all subsequent steps.

Example Output

Given examples INV-2026-044, INV-2026-045, INV-2026-046:
{invoice_number_local} → "INV-2026-047"

Tips

  • Always provide at least 2 examples — the AI needs a pattern to follow, not just one number
  • Include context about year resets in the Pattern Description if your series resets annually
  • Test before scheduling — run the step manually first to confirm it produces the expected output
  • If you have an existing “last used” invoice number that isn’t in the examples, mention it in the Pattern Description: “Last used number was INV-2026-046”
Each run of this step consumes one AI call for complex patterns. Simple numeric formats (e.g. INV-001 → INV-002) are handled deterministically without an AI call.
This step generates the next logical number based on the pattern — it does not check your records to guarantee uniqueness. Make sure you’re providing the most recent example numbers, and that automations using the same local sequence do not run in parallel.