I changed a field from being a single line of text, to being a lookup (still only displaying a single line of text, but it's fetched from another list. The field's internal name is Status
. This is where I get an error:
oListItem.get_item('Status');
The error reads:
The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
So I changed this line
clientContext.load(listItemCollection);
to
clientContext.load(listItemCollection, 'Include(Status)');
Now, the executeQueryAsync
's failure handler is called with the following error:
Value does not fall within the expected range.
Any ideas what might be causing this? The code worked before I changed the column type, so the problem shouldn't be with any other code...
Edit:
Based on Dikesh Gandhi's suggestion, I tried adding the following to my caml query:
<View><ViewFields><FieldRef Name="Status" /></ViewFields></View>
But then the original error (not initialized) returned, regardless of if I have the include-string passed to the load
function.