- You are developing an event receiver where you are evaluating the AfterProperties value of an SPFieldChoice column.
- The column's internal name does not match the display name.
- The AfterProperties value for this field always return null/nothing.
- MS oddly decided that this field should utilize the Title instead of the InternalName for the AfterProperties Key. I have not verified this with the BeforeProperties, but wouldn't be surprised if it's the same.
- Following is the code I used to workaround this:
Dim afterObj As Object = properties.AfterProperties(field.InternalName)
If afterObj Is Nothing AndAlso TypeOf field Is SPFieldChoice Then
'Microsoft Bug that choice field uses Title instead of InternalName on AFterProperties.
'Checks for null value first in case MS fixes this later and to reduce overhead.
afterObj = properties.AfterProperties(field.Title)