How to Automate Contract Numbering and a Registry
Automatic contract numbering removes the riskiest step in paperwork: the number somebody types by hand. In Planfix, a script calculates the contract number, writes it into the document generated from a document template and adds a row to the contract registry, so two deals can never share a number. This three-minute video walks through the whole setup, from the fields on the deal card to the annual counter reset.
What You’ll Learn: How to Automate Contract Numbering in Planfix
- How automatic document generation and numbering work, from the deal to the registry (0:00).
- Which fields the deal card needs for the contract number and for the registry (0:40).
- How one script recalculates the number, creates a subtask and attaches the contract (1:20).
- How a recurring task resets the number counter once a year.
How to Set Up Contract Numbering in Planfix, Step by Step
Step 1. Add the Numbering Fields to the Deal Card
Numbering is configured at the object level, and in the video the object is the deal. Open the card settings and create a field for contract numbering: choose Short text as the field type and turn on the no-duplication option, so the same value can never be saved twice. The script will fill this field from the main contract number field, a Number field prepared in advance. Then add one more field for the registry: it has the Directory entry type and points to the contract registry directory you created earlier. That is everything the card needs.
Step 2. Prepare the Contract Template
A document template is a Word or Excel file with Planfix variables inside it. Write the contract text, add the variables that reference the fields of the task, then upload the file in Documents → Document templates → New template. A template can be up to 15 MB, and the name of the generated file can be built from variables as well.
Step 3. Build the Script That Does the Work
Create a script for the object, give it a name, then set the trigger and the conditions that start it, such as the deal reaching the contract signing stage. In the actions section, ask the script to:
- recalculate the main contract number field;
- create a subtask from a template;
- calculate the contract number in an Infoblock and set that value in the task field;
- rename the task and attach the document generated from the template;
- create an entry in the contract registry directory and fill it with the number from the Infoblock, the creation date and the counterparty from the task;
- set the contract number field in the task so that it matches the number in the registry.
Planfix scripts run those actions in order every time the condition is met, so the sequence is the same for the first contract and the thousandth.
Step 4. Reset the Counter Once a Year
Most companies start numbering again in January. Create a second script and choose the creation of a recurring task as its trigger, so the script runs once a year; any task template will do. Give it a single action: reset the main contract number field to zero. When the automation runs, a task appears in the manager’s Chronicle to say the numbering has been updated, and the next contract is generated with the new number.
What the Automation Looks Like in a Deal
For the person in sales, nothing changes: they manage the deal the way they always have. Once the deal reaches the contract signing stage, Planfix creates a subtask with a completed contract attached, generates the contract number and puts it into both the document and the registry directory, next to the creation date and the counterparty. Nobody opens a spreadsheet to find out which number comes next, and nobody writes the same number twice.
Who It’s For
- Sales teams: the contract arrives in the deal already numbered and attached, so nobody waits for paperwork.
- Legal and document control: one registry with numbers, dates and counterparties instead of a shared file that someone forgot to update.
- Finance: every contract number is unique, which makes invoices and payments easy to match to a deal.
- Administrators: the numbering rule lives in one field and one script, so changing the format is a short job.
FAQ
Can Planfix generate contract numbers automatically?
Yes. A script recalculates the main contract number field, calculates the number in an Infoblock and writes it into the task field, the document generated from the template and the contract registry directory.
How do you prevent duplicate contract numbers?
Turn on the no-duplication option for the contract numbering field on the card. The value is calculated by the script rather than typed, and every number also lands in the registry directory, where the whole sequence is visible.
How do you reset contract numbering at the start of a year?
Use a second script with the creation of a recurring task as its trigger, so it runs once a year, and give it one action: set the main contract number field back to zero.
Final Thoughts
Start with one object and one contract template: add the numbering fields, upload the template, then let a single script do the rest. For a close relative of this setup, see how to automate commercial proposals and deal numbering. New to Planfix? Sign up and try it on your next contract.
This video was featured in What’s New in Planfix: October 2026.
