Search
Close this search box.

Build a simple auto increment feature in SharePoint 2013 list

Every now and then I stumble across this requirement. And every time I seem to have forgotten how to do it, and try various approaches like using a calculated field based on Id, or using a workflow based on the Id.

Bottom line is, at the time of creation, the item Id is not yet set, so you cannot use it, neither from a calculated field nor from a workflow. But with a small workaround, it is possible to make it work in an easy and robust way. After writing this post, I hope I will remember the next time.

First, you need your list, I created one called “TestList”. I added an “AutoNumber” field of type number.

Second, you need a second list. I created one called “NumberSeries”. I will only use the ID field of this list, so no further customization is necessary.

Third, I you need a workflow. The workflow will run upon creation of list elements in TestList, create a new list element in NumberSeries, and then assign the ID of the newly created item to the AutoNumber field in TestList. 

And voila, you are done!

This is not more robust than it will allow troublemakers to assign random numbers to elements by updating them directly, but it is robust enough that it will give you a new, incremented number for every element you create, even if you delete all elements in either list.

If you need something more robust, or if you need further customization like special formatting, you will need to look to either event receivers or javascript. But for a quick and easy solution, this works nicely.

This article is part of the GWB Archives. Original Author: Thorvald Boe

Related Posts