After a couple of weeks of development of a custom list form, I finally delivered it to my manager for review. Everything looks great and promising, until she hit the “OK” button to submit the form. An unexpected screen had appeared with the message “An unexpected error has occurred.”. I feel that I have just committed the biggest sin as a developer, i.e. lack of testing before delivery.
While cursing in my mind about how poor the error message was, I quickly jumped onto the code to try resolve the issue. All seems in perfectly good order. So plan B, is to Google it. Fortunately, I was able to find this post by Vincent Rothwell to help me get a better error message from SharePoint. (Thanks Vincent!)
This time I have a stack of funny error message displayed on screen, which still doesn’t help. After more googling, I have concluded that one or more internal field names were incorrect in the form. It is quite possible as I have deleted and re-created a couple of the fields towards the end of my development. It turned out the field names has a different case before and after its recreation:
In case, anyone has come across the same issue, this might be a good starting point to your debugging exercise. Let’s hope the error messages will improve in SharePoint 2010… (XX fingers crossed XX)