In the following code actionName is the name of action.
primarycontact and parentaccount is the entityreference attribute in action.
name and email is the string attribute in action
primarycontact and parentaccount is the entityreference attribute in action.
name and email is the string attribute in action
var oDataEndpointUrl = Xrm.Page.context.getClientUrl() + "/api/data/v8.0/actionName";
var service = new XMLHttpRequest();
service.open("POST", oDataEndpointUrl, false);
service.setRequestHeader("Accept", "application/json");
service.setRequestHeader("Content-Type", "application/json; charset=utf-8");
service.setRequestHeader("OData-MaxVersion", "4.0");
service.setRequestHeader("OData-Version", "4.0");
var parameter = { "name": "nizam",
"email": "syed.nizam69@gmail.com",
"primarycontact": { "contactid": "AEAD37F8-F39D-E511-80D3-2C59E5420648", "@odata.type": "Microsoft.Dynamics.CRM.contact" },
"parentaccount": { "accountid": "54AD37F8-F39D-E511-80D3-2C59E5420648", "@odata.type": "Microsoft.Dynamics.CRM.account" }
}
service.send(JSON.stringify(parameter));
if (service.readyState == 4 /* complete */) {
if (service.status == 201 || service.status == 200) {
}
}
Hi Syed,
ReplyDeletethanks for post. Unfortunately for Custom Entities it was not working on our end.
var params {
"inputparamname": {
"": "",
"@odata.type": "Microsoft.Dynamics.CRM."
}
}
Found also some error reports/posts:
https://community.dynamics.com/crm/b/dynamicscrmdevdownunder/archive/2015/02/21/bug-limitation-of-action-entityreference-input-argument
Any idea here?
"parameterName
ReplyDelete": { "lookupFieldName": "AEAD37F8-F39D-E511-80D3-2C59E5420648", "@odata.type": "Microsoft.Dynamics.CRM.EntityLogicalName" }
Replace parameterName with your action parameter name
lookupFieldName with your lookup field name
EntityLogicalName replace with your custom entity logical name