So I'm trying to autoincrement a field on a list item. First i tried using a calculated value field "=[ID]" which works the first time, but after saving a new item to the list the "" are gone and, the calculation is dropped. I also tried using a workflow like "when item is created, set my_id = ID" but I got type errors, as ID is a double, and Sharepoint(as far as I've found) cannot handle conversion on the fly(?) I have to say, that I have not tried to code this into an event receiver, it seems like the only way, unless any of you have any ideas. Thanks for reading my question.
To answer all your questions/doubts..
ID Column in Calculated Column
Excerpt from Microsoft documentation
You cannot reference the ID of a row for a newly inserted row. The ID does not yet exist when the calculation is performed.
Using SharePoint Designer Workflow
There are many posts which show solution to this problem using SharePoint Designer Workflows or other workarounds (using extra list and so on).. Please have a look at:
Add a Unique Auto-Incrementing Column to a SharePoint List
Screenshots of Workflow used in above post
Using the Row ID value in a calculated column
Using SP ID in Calculated Field No Code
Of course for developers the first thing that comes to mind is writing an Event Receiver for the List. On
ItemAddedyou can retrieve ID of the item.
I hope this helps
You can use WorkFlow for this. Create another list, use your WorkFlow to create a new blank item on this list and get ID of this new item for your incremental column. ID values on list are incremental, so you dont need to do anything except create and get ID value. If you want to reset the ID value, you need to drop and re-create this value list.