Auto-Generating Serial Numbers with Custom Number Series in Zoho Creator

 When working with business applications, it’s often necessary to generate unique identifiers for records such as requests, invoices, or assets. While Zoho Creator provides a default auto-number field, it doesn’t always allow the flexibility businesses need—such as custom prefixes, ranges, or increments.

Inspired by the Number Series functionality in Microsoft Dynamics 365 Business Central, I developed a custom auto-numbering system in Zoho Creator that gives full control over serial number generation.


Why Custom Number Series?

Different organizations have different requirements for numbering their records. For example:

  • A Prefix to represent the type of record (e.g., REQ_ for requests).

  • A Starting Number to decide where the series begins (e.g., start at 1000).

  • An Increment to skip numbers in a defined pattern (e.g., +1, +5, etc.).

  • An Ending Number to enforce a limit (e.g., stop at 9999).

This flexibility makes it easier to manage records, avoid duplication, and align with company standards.


The Table Setup

In my case, I created a No_Series table that allows administrators to configure the numbering series. Example fields:

  • Number_For – The entity (e.g., "Expiry Request")

  • Prefix_of_The_No – The prefix string (e.g., REQ_)

  • Starting_No – The first number in the sequence

  • Increment_by_No – The step value (default 1)

  • Ending_No – The last number allowed


The Auto-Numbering Script

Here’s the Deluge script I used inside the form’s On Add > On Success workflow:

no_series = No_Series[Number_For == "Expiry Request"]; if(no_series != null && no_series.Prefix_of_The_No != null) { prefix = no_series.Prefix_of_The_No; start_no = if(no_series.Starting_No != null,no_series.Starting_No.toNumber(),1000); increment_by = if(no_series.Increment_by_No != null,no_series.Increment_by_No.toNumber(),1); end_no = if(no_series.Ending_No != null,no_series.Ending_No.toNumber(),null); } else { prefix = "REQ_"; start_no = 1000; increment_by = 1; end_no = null; } if(input.Request_ID == null || input.Request_ID.trim() == "") { asset = Request_For_Expired_Products[Request_ID != null] sort by Request_ID desc; if(asset != null && asset.Request_ID != null) { last_id_str = asset.Request_ID.toString().replaceAll("[^0-9]",""); if(last_id_str != "") { last_id = last_id_str.toNumber() + increment_by; } else { last_id = start_no; } } else { last_id = start_no; } if(end_no != null && last_id > end_no) { alert "Auto-numbering has reached the maximum limit of " + end_no.toString(); } else { input.Request_ID = prefix + last_id.toString(); } }

OutPut








How It Works

  1. Fetch Number Series Setup

    • It checks the No_Series table for the matching record (Number_For == "Expiry Request").

  2. Assign Defaults if Not Found

    • If no custom setup is found, it defaults to:

      • Prefix: REQ_

      • Start: 1000

      • Increment: 1

      • No Ending Limit

  3. Get Last Used Number

    • It looks at the last record created and extracts the numeric part.

  4. Generate Next Number

    • Adds the increment to the last number, ensuring it doesn’t cross the ending limit.

  5. Assign to Record

    • Updates the Request_ID field with the new number.


Benefits of This Approach

✅ Flexible numbering system similar to ERP standards
✅ Avoids duplicate numbers
✅ Easy for users to identify record type from prefix
✅ Supports multiple entities with different numbering rules


Final Thoughts

With this approach, you can create a scalable and customizable auto-numbering system in Zoho Creator that adapts to your organization’s needs.

This method is highly useful if you’re coming from an ERP background like Microsoft Dynamics 365 Business Central, where number series are a standard practice.

You can extend this solution by:

  • Adding year/month prefixes (e.g., REQ_2025_1001).

  • Resetting numbers annually or per project.

  • Allowing admins to configure series dynamically via a dashboard.

Comments

Popular posts from this blog

How I Built an Interactive Employee Attendance Tracker in Zoho Creator

How to Add Animated Views in Zoho Creator Pages Using HTML Snippets