I have a field collection group to which I am importing values using Field Collection Feeds Importer. This requires a unique identifier field within the field collection. This has posed an issue where the user has to keep track of these identifier fields. One way to avoid this is having an auto increment field so that when a new row is added it automatically auto increments this field without any user interaction. This would also help maintain the correct sequence at all times and avoid any user editing accidental mistakes.

This is how it is right now enter image description here

Any ideas or existing functionality to use this.


1 Answer 1


The Serial Field module should be able to do that:

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.

  • Serial Field is not compatible with Field collection as per the description on module page 'This is caused by the lack of proper entity support. See #1333032: Add generic entity support for details. This is a rather large job so any patches would be appreciated.' Also since its hidden it makes it difficult to update rows while importing.
    – pal4life
    May 6, 2015 at 19:09
  • as far as I know that's the only auto-increment field around, so you can either modify it to suit, or start from scratch with a custom module
    – Geoff
    May 6, 2015 at 19:13
  • Any comments on how to work with that Add another item button. I suppose it will have to be hooked in with the content type template file.
    – pal4life
    May 6, 2015 at 19:14
  • I don't know how field collections deals with that, and what AJAX calls it makes - it could be you need to create a custom field collection, with a built-in auto-increment option, if there aren't hooks that can just be tapped into. I would take a look at the field collection module code first, and follow the execution
    – Geoff
    May 6, 2015 at 19:18
  • Finally, you know of whats the way to make the serial field visibile, if I can ask here?
    – pal4life
    May 6, 2015 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.