Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
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 '10 at 21:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.