Serial Field

Component ID

594064

Component name

Serial Field

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

58425

Component created

Component changed

Component body

This module provides an auto-increment (serial) field.

Unlike Drupal's built-in auto-increment node ID, which is global and shared by nodes belonging to all content types, serial fields are managed per content type (D6) / entity (D7). For example, the serial field of an Invoice instance will generate a unique sequential number (starting at 1, then 2, etc.) exclusively for Invoice instances.

The allocation of serial numbers by this module is atomic. In other words, the serial values are unique even when multiple instances of the same content type / entity are created simultaneously.

Dependencies

  • Drupal 6 - the CCK module
  • Drupal 7 - the core Field module has to be enabled

Optional modules

Installation

  1. Copy the serial module directory to your Drupal sites/all/modules/ directory.
  2. Enable the module in administer > modules (admin/build/modules).

Usage

You can add a serial field to any type at admin/content/types -> manage fields.
In the New Field form select Serial as the type of data and label and field name as your choice, and Save. No other settings.

Notes:

  • Existing nodes will also get serial values when a serial field is added.
  • The serial token [{entity_type}:{field_name}] can be used with Path Auto. All information about available tokens can be found at admin/config/search/path/patterns page in Replacements patterns section.
  • If you're upgrading from Drupal 6, make sure that this module is enabled before the CCK to fields migration. You'll get one or more errors about trying to create tables that already exist, but you can safely ignore these. Feel free to create an issue & patch to fix that.

Similar Modules

Serial numbers can be generated also by the Type-local nids module. The main differences between the two modules are:

  1. The Serial Field module provides a CCK field.
  2. ID allocation by Serial Field is atomic (i.e. the same ID cannot be issued to more than one node).