SharePoint Client Object Model “Field does not exist” error

Mike BerrymanI was working with the SharePoint Client Object Model in Javascript a couple days ago and ran into the ever-so-common not-helpful error message of “Field does not exist” whenever any user other than myself would try and create a list item.  The weird part was, despite this error message, the list item was being created perfectly with no issues, with the field in question filled in exactly as entered on the form.  The only reason I knew there was an error was the fail callback function was being triggered, and consequently an alert box popping up with the “Field does not exist” error.

My first inclination was that this had something to do with permission, since it wasn’t happening when my account (the admin account) was logged in.  I had some other admins try the functionality, only to have them get the same error.  Even site collection administrators were getting this error.  The woefully little javascript client object model documentation there is out there left me with little choice but to actually debug the scripts and narrow down exactly what was going on.

It was painful but eventually I was able to dig far enough into the scripts to get a correlation Id for the error which allowed me to examine the SharePoint ULS logs.  There, I found a much more helpful error message letting me know that the lookup list threshold was being exceeded.  The lookup list threshold is a resource-saving setting that tells SharePoint to only show so many lookup fields to users, since each lookup field requires loading a whole other list.  You can imagine if you have a list with, say, 100 lookup fields, having SharePoint load 100 extra lists whenever you want to look at it would be cumbersome on both the system and the user’s patience.  There is a setting for each Web Application in Central Administration that limits the amount of lookup fields that regular users are allowed to load in one request.

Armed with this new knowledge, I found out that in the development environment I had written this javascript code in, the lookup threshold was set way higher than the environment we were seeing this “Field does not exist” error in.  Additionally, because I was acting as the primary site collection administrator for the site, I was circumventing this limit while everyone else was constrained.  I bumped up the limit and voila – no more error!

Unhelpful error messages are a real pain, especially when you can very easily tell at a glance that the reported error is just plain wrong.  Hopefully I’ve saved someone else the trouble having to debug scripts in the browser until something actually helpful pops up.

One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s