Why does my calculated column not pick up the correct ID
-
16-10-2019 - |
Question
I'm trying to create a calculated column that uses the list item's ID field as part of the calculated string value. When I create a new list item, the calculated field seems to always use 0 as the ID value. I know that during creation, the new list items ID is 0 until the content database is updated, which apparently generates the actual ID. Is there a way to get the calculated column to accurately reflect the ID value of the list item?
Solution
Its a matter of the order the operations run in. The calculated fields are done by the application before the insert is done to the database. The way around this is to create a workflow that fires on creation of a record to update the value of a field (text) with the formula you need. This has the added advantage of supporting more complicated calculations or lookups not supported using the calculated column field type.