Hi I want to update value of option set field which is on another form using API
below is my code but is says bad request or internal server error.
I am doing this using API as setting option set using workflow has bug in crm 8.2 version
i tried using getselectedoption / getoptiontext etc but it is not working can anyone please help
var entity = {};
entity["new_unit"] = Xrm.Page.getAttribute("aga_unit").getValue(); //this is option set
var req = new XMLHttpRequest();
req.open("PATCH", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/redit_beratungs("+ConsID+")", false);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 204) {
//Success - No Return Data - Do Something
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(entity));
*This post is locked for comments