Question

im scripting in sharepoint2010 foundation, using jquery/javascript. this is a question about jquery spservices.

im trying to get fieldvalues from a list and use the values in another list.

$().SPServices({
  operation: 'GetListItems',
  async: false,
  listName: 'Bedrijven',
  CAMLRowLimit: 10,
  CAMLQuery: _queryCompanie,
  CAMLViewFields: "<ViewFields><FieldRef Name='WorkPhone'/><FieldRef Name='WorkCity' /><FieldRef Name='Title' /></ViewFields>",
  completefunc: function(xData, Status){
    $(xData.responseXML).SPFilterNode("z:row").each(function(){
      var _itemTitle = $(this).attr('ows_Title');
      var _itemCity = $(this).attr('ows_WorkCity');

      alert('WorkCity == ' + _itemCity);
    });
  }
});

the problem is, im getting the title field, but i also need the workcity field. but if im doing it as above im getting undefined back when i alert it.

thanks in advance.

Was it helpful?

Solution

I just ran this in my test environment with a Contacts list as the source, and it worked for me. You might want to check the returned data in Firebug or Fiddler to see what's happening.

Note that if the WorkCity column is empty, you'll get undefined in your code. Items are stored sparsely.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top