Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: CAML Query problem

$
0
0
Hi

I'm trying to get a value from a list based on the the current user logged in. So I'm using your wonderful SPServices and I've got it partly working. If the code below has query = "" then it works, so I have the code almost there.

Can someone please look at the query line and how I'm using it and point out what I'm doing wrong please? Apologies if it is really obvious and I'm being blind.
$(document).ready(function () {
    // Set variables up
    var method="GetListItems";
    var list="SiteList";
    var fieldsToRead="<ViewFields>" +
                        "<FieldRef Name='Title' />" +
                        "<FieldRef Name='SiteOwner' />" +
                        "<FieldRef Name='Assessor' />" +
                    "</ViewFields>";
    
    var query = "<Where>" +
                    "<Eq>" +
                        "<FieldRef Name='Assessor'></FieldRef>" +
                        "<Value Type='Integer'><UserID /></Value>" + 
                    "</Eq>" +
                "</Where>";
   alert(list + method);
  $().SPServices({
    operation: method,
    async: false,
    listName: list,
    CAMLViewFields: fieldsToRead,
    CAMLQuery: query,
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
        alert($(this).attr("ows_Title") + "!!");
        $("#tasksUL").append(liHtml);
      });
    }
  });
});
Thanks

Laura GB

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>