2

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?

1 Answer 1

2

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.

1
  • 1
    I figured as much. A workflow, or even just an event listener, would do the trick. I'm programmatically creating this list item anyways though, so I'm just calling SystemUpdate() twice. Once to create the bulk of the item, then again after calculating and assigning the additional field. Was hoping to get away without calling it twice.
    – Chaulky
    Sep 10, 2010 at 21:10

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.