Hello,
I'm trying to associate a role to a user in the CRM, using the code built in CRM BUILDER of Jason Lattimer .
How ever, i'm getting the following error 500:
{
"error": {
"code": "",
"message": "propertyValue (System.Uri) should be EdmEntityObjectCollection",
"innererror": {
"message": "propertyValue (System.Uri) should be EdmEntityObjectCollection",
"type": "Microsoft.Crm.CrmException",
Here is the query
var association = {"@odata.id": Xrm.Page.context.getClientUrl() + "/api/data/v8.2/systemusers(f7febf8b-b19d-40a4-8ec8-df2f517066cd)" }; var req = new XMLHttpRequest(); req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/roles(411806b8-697f-4afd-8520-21092b51a05d)/systemuserroles_association/$ref", false); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.onreadystatechange = function() { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 204 || this.status === 1223) { //Success - No Return Data - Do Something } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send(JSON.stringify(association));
Could you please help?
Thank you,
Regards