I have a regular custom list with all sorts of data but the one that's not working with the spservices getlistitems is the managed metadata field.
I am getting undefined when I tried to use ows_documentname .
Any suggestions are greatly appreciated
I have a regular custom list with all sorts of data but the one that's not working with the spservices getlistitems is the managed metadata field.
I am getting undefined when I tried to use ows_documentname .
Any suggestions are greatly appreciated
On
The value of the managed metadata field will be returned in the ID;#Value format.
So, you need to split it using javascript split function as below. Here, the internal name of managed metadata column is Test:
$(this).attr("ows_Test").split(";#")[1]
Modify the code as per your column internal name.
The full code that i used is:
$().SPServices({
operation: "GetListItems",
async: true,
listName: "Documents",
CAMLQuery: "<Query><OrderBy><FieldRef Name='Title' /></OrderBy></Query>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function () {
console.log($(this).attr("ows_Test").split(";#")[1]);
});
}
});
Please see the capture about the metadata field value format, it will like "ID;#Label":
Please split this like: