【发布时间】:2017-10-13 16:41:37
【问题描述】:
我收到一个似乎无法调试的错误。我正在尝试通过自定义 HTML/JavaScript Web 资源创建自定义活动实体。
用户点击一个按钮和以下参数:
var params = {
'rob_faqid@odata.bind': '/rob_faqs(guid-here)',
'rob_source': 180840000,
'subject': 'Signpost',
'actualstart': new Date(),
'actualend': new Date()
};
被传递到这个 URL:
https://dynamicsorg/api/data/v8.2/rob_quickactions/
带有以下标题:
xhr.setRequestHeader('OData-MaxVersion', '4.0');
xhr.setRequestHeader('OData-Version', '4.0');
xhr.setRequestHeader('Accept', 'application/json');
xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
xhr.setRequestHeader('Prefer', 'return=representation');
这给了我一个400 (bad request) 的 HTTP 代码和这个错误消息:
An undeclared property 'rob_faqid' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.
有趣的是,无论我是使用实际的 GUID 还是在其中添加了一些乱码(暗示它与传入的值无关),我都会收到此错误。
我可以通过标准表格手动创建记录。
我在同一个项目的其他地方使用odata.bind,没有任何错误。
【问题讨论】:
-
似乎无法识别您发送的值,因为它被标识为空白。服务期望的格式是什么?
标签: javascript asp.net-web-api microsoft-dynamics dynamics-crm-online dynamics-365