Dynamics crm 无法删除Dynamics 365约会';s关于使用Web API的对象值
我正在尝试使用Microsoft Dynamics 365 Web API从约会实体中删除字段Dynamics crm 无法删除Dynamics 365约会';s关于使用Web API的对象值,dynamics-crm,dynamics-365,dynamics-crm-365,appointment,dynamics-crm-webapi,Dynamics Crm,Dynamics 365,Dynamics Crm 365,Appointment,Dynamics Crm Webapi,我正在尝试使用Microsoft Dynamics 365 Web API从约会实体中删除字段关于对象ID的值。无法执行,但显示以下错误: { "error": { "code": "", "message": "The property 'regardingobjectid' does not exist on type 'Microsoft.Dynamics.CRM.appointment'. Make sure to only use property names th
关于对象ID的值。无法执行,但显示以下错误:
{
"error": {
"code": "",
"message": "The property 'regardingobjectid' does not exist on type 'Microsoft.Dynamics.CRM.appointment'. Make sure to only use property names that are defined by the type."
请求
PATCH https://XXXXXXX.crm.dynamics.com/api/data/v8.2/appointments(9de8ba18-8303-e911-8147-3863bb2eb450)
标题:
Content-Type: application/json
Authorization: Bearer *Token*
{
"subject": "Check Updates",
"ownerid@odata.bind": "/systemusers(51d09106-22b6-e811-8143-3863bb2ec140)",
"createdby@odata.bind": "/systemusers(51d09106-22b6-e811-8143-3863bb2ec140)",
"location": "",
"description": "nuldasddsadsal",
"statecode": 3,
"scheduledstart": "2018-12-19T06:45:00Z",
"scheduledend": "2018-12-19T07:15:00Z",
"isalldayevent": false,
"regardingobjectid": null,
"activitypointer_activity_parties": [
{
"partyid_account@odata.bind": "/accounts(4a2612e2-664b-e411-93ff-0050569469bd)",
"participationtypemask": "6"
}
]
}
正文:
Content-Type: application/json
Authorization: Bearer *Token*
{
"subject": "Check Updates",
"ownerid@odata.bind": "/systemusers(51d09106-22b6-e811-8143-3863bb2ec140)",
"createdby@odata.bind": "/systemusers(51d09106-22b6-e811-8143-3863bb2ec140)",
"location": "",
"description": "nuldasddsadsal",
"statecode": 3,
"scheduledstart": "2018-12-19T06:45:00Z",
"scheduledend": "2018-12-19T07:15:00Z",
"isalldayevent": false,
"regardingobjectid": null,
"activitypointer_activity_parties": [
{
"partyid_account@odata.bind": "/accounts(4a2612e2-664b-e411-93ff-0050569469bd)",
"participationtypemask": "6"
}
]
}
两件事:
1.要使用web api更新/覆盖查找字段值,我们必须使用单值导航属性<代码>关于ObjectId_account@odata.bind
var entity = {};
entity["regardingobjectid_account@odata.bind"] = "/accounts(1F496057-8DE7-E811-A97A-000D3A1A9EFB)";
var req = new XMLHttpRequest();
req.open("PATCH", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/appointments(6D78AD2C-5A16-E811-A955-000D3A1A9407)", true);
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));
2.如上所述,PATCH
用于更新所有字段类型的值,除了删除查找值(在查找中更新null
),我们必须使用DELETE
和在一些研究请求之后删除:对于删除目标,我很适合