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

New Post: Single List Item

$
0
0
So, the way that I was able to pass in the ID for the CAMLQuery was to change my library settings to not use dialogs, so that I could grab the query string value of the item record, using Marcs $().SPServices.SPGetQueryString(), thanks Marc!

Just for anyone else that may want to read, I implemented it similar to the way Marc has in his documentation. Notice that I use qsID in the CAMLQuery as the ID. I would love to be able to continue to use the dialog, however that is more of a user preference there may be equal users who prefer the page over the dialog so I should not be predjudice. This is my custom project anyways, so they can live with the page for now.
    var qsVals = $().SPServices.SPGetQueryString();
    var qsID = qsVals["ID"];
        
    // pass qsID into the CAMLquery below
        
    $().SPServices({
        operation: 'GetListItems',
        async: false,
        //debug: true,
        listName: 'IT Assets',
        CAMLViewFields: '<ViewFields><FieldRef Name="Location" /></ViewFields>',
        CAMLQuery: '<Query><Where><Eq><FieldRef Name="ID"/><Value Type="Counter">' + qsID + '</Value></Eq></Where></Query>',
        completefunc: function(xData, Status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function() {
                alert($(this).attr("ows_Location").slice(3));
                alert($(this).attr("ows_ID"));
            });
        }
    });
    
    
});


Viewing all articles
Browse latest Browse all 6517

Trending Articles



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