How to retroactively set autonumbers on records
In this post, all be showing you how to add in auto numbers for old records that may needed if a new id field has ben created. A video on this can be found here
If you wanted to run an autonumber expression on pre-existing records, you need to use two expressions.
The first thing to do is to differentiate between old records and current through a date difference expression. So create a new number field (this will be temporary and you can delete this after the end of these steps) with the ID - DateDifference and input this expression:
datediff(DateTimeNow(),CreatedDate())
You then need to re-run this expression for all records - a good way of doing this is through exporting the data and then importing it back into the app - for more information please see here:
https://support.softools.net/hc/en-gb/articles/6726731608977-Bulk-Updating-Expressions
So you should end up with numbers in each of these fields like so
Then, in the field that requires an autonumber, use this expression:
if([DateDifference]>0,autonumber('FieldID'),0)
Like so:
This will mean that any records with a date difference larger than 0 (so any created before the current date) will have generate an autonumber.
You will need to update this expression through workflow or through export and import again and you should end up with the fields being populated with the autonumber as shown
You can then find the largest autonumber that you have created and set the autonumber toggle to true, with the next number being one up from your largest autonumber so that all new records will continue from this number
Please sign in to leave a comment.
Comments
0 comments