title: Retrieving LookupValues, Javascript SharePoint 2013, Not Working
body: <p>I've seen a lot of info on the above question but none of it has answered what I'm looking for, so far. I'm trying to retrieve list items that have a great number of lookup fields. I've had success getting to some of the lookup values but not others and I can't figure out why. Also, it would appear that 'null' items are not accepted in the returned data? If the lookup field does not contain a value, it throws an error? Is this correct? Below is my code. The other issue (the big issue mentioned in my title) is that lookup values where I'm trying to pull in something, other than ID or Title, throws an error: reference not found or initialized. In this instance my lookup field is referencing a calc column returned as a single line of text. So my lookup field is Course1Date/DateRange, where DateRange represents the fieldname of the calc column. Error: "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."</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function getLookupValues(){
      var clientContext = SP.ClientContext.get_current();
      var list = clientContext.get_web().get_lists().getByTitle('Lookup');
      var caml = new SP.CamlQuery();
      caml.set_viewXml('&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Geq&gt;' + 
                  '&lt;FieldRef Name=\'ID\'/&gt;&lt;Value Type=\'Number\'&gt;82&lt;/Value&gt;' + 
                  '&lt;/Geq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;RowLimit&gt;10&lt;/RowLimit&gt;&lt;/View&gt;'); 
  
      var returnedItems = list.getItems(caml);
      clientContext.load(returnedItems);
      clientContext.executeQueryAsync(success, failure);
      }
      function success(){
      var listiteminfo='';
      var enumerator = returnedItems.getEnumerator();
      while(enumerator.moveNext())
      {
        var listItem = enumerator.get_current();
        if(listItem.get_item('Course1')) {
          var course1 = listItem.get_item('Course1').get_lookupValue();
        }
        if(listItem.get_item('Course2')) {
          var course2 = listItem.get_item('Course2').get_lookupValue();
        }
        if(listItem.get_item('Course1Date')) {
          var course1Date = listItem.get_item('Course1Date').get_lookupValue();
        } //throws error for this lookup field
  
    listiteminfo += '\nCourse1: '+course1+'\nCourse2: '+course2+'\nCourse1Date: '+course1Date;
  
      }
      alert(listiteminfo);
              }
      function failure(){
      alert("Failed");
      }</code></pre>
  </div>
  </div>
  </p>