As i have understand it by googling a litle, that its not posible to use REST for Taxonomy fields ? I was not able to update my list doing it by http REST . But it should be posible with JSOM.
How can I save a managed metadata value in my SP.List
?
I have a list with one MMD column which I want to update.
My code looks like:
$scope.saveProsessConnection = function (propertyName) {
var taxPickerIndex = $("#taxPickerOpenSingle").val();
console.log(taxPickerIndex);
var result = $.parseJSON(taxPickerIndex);
console.log(result);
var listTitle = "GNTiles";
var taxFieldName = "Prosess";
var termGUID = result[0].Id;
var termLabel = result[0].Name;
console.log(termGUID);
console.log(result);
var context = new SP.ClientContext(appWebUrl);
var list = context.get_web().get_lists().getByTitle(listTitle);
var item = list.getItemById(tileId);
//console.log('Item Id: '+item.id);
var termValue = "-1" + ";#" + termLabel + "|" + termGUID;
item.set_item(taxFieldName, termValue);
item.update();
context.load(item);
context.executeQueryAsync(onSuccess, onFailure);
function onSuccess() {
//retriveListItem();
console.log("Success!!")
}
function onFailure(sender, args) {
console.log('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
}
And my data looks like :
[{"Id":"e0a1f57a-6746-4ecc-b119-47f2ff80a1ea","Name":"L3-2 Forbedringsprosess","PathOfTerm":"L3 Lede og forbedre;L3-2 Forbedringsprosess","Children":[],"Level":1,"RawTerm":null}]
The error iam getting is:
Request failed. Unexpected response data from server. null