Hi All,
Need your help.
I want to retrieve the list item id of another list depending on a value.
E.g I have list named "A", on whose edit form I will writing javascript. Using this Jquery/JavaScript I want to retrieve List Item ID of list named "B".
In List A, on edit form, its item ID is equal to one of the column in List B.
I will match this value and get the List item ID in list "B".
I have used following code but Item ID returned is undefined. Please let me know if below code is right or it needs modification.
var LibID=GetUrlKeyValue("ID");
var queryLookup = "<View>><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>"+LibID+"</Value></Eq></Where><OrderBy><FieldRef Name='Title' Ascending='TRUE'
/></OrderBy><ViewFields><FieldRef Name='Title' /></ViewFields></Query></View>";
var itemID="";
// Call GetListItems to return the ID
$().SPServices({
operation: "GetListItems",
async: false,
listName: "B",
CAMLViewFields: "<ViewFields><FieldRef Name='ID'/></ViewFields>",
CAMLQuery: queryLookup,
completefunc: function(xData,Status) {
//itemID = $(xData.responseXML.xml).find("z\\:row").attr("ows_ID");
itemID = $(xData.responseXML).SPFilterNode("z:row").attr("ows_ID");
//itemID = $(this).attr("ows_ID");
}
});
alert("itemID="+itemID);
Your help is appreciated as I am stuck on this.
Thanks & regards,
Manish