在Navigation Property上设置查找属性失败

时间:2017-07-05 15:53:59

标签: javascript dynamics-crm microsoft-dynamics dynamics-crm-webapi microsoft-dynamics-webapi

我正在使用Microsoft Dynamics WebAPI尝试POST以下json。帖子返回成功,但在我的数据中没有设置ccseq_employeeid和ccseq_clientid。我需要更改什么才能使字段正确发布?

实体结构

ccseq_expensetransaction查找ccseq_expensetransactionsets,其关系名称为ccseq_ccseq_expensetransactionset_ccseq_expensetransaction_ExpenseTransactionSetID。对systemusersccseq_clients的查找是ccseq_expensetransaction实体的一部分。

代码

POST /api/data/v8.0/ccseq_expensetransactionsets HTTP/1.1
Host: url.com
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 24f7ead3-0307-996f-f45a-f959c604c922

{
   "ccseq_importdate":"2017-06-05T04:00:00Z",
   "ccseq_month":"1",
   "ccseq_year":"2017",
   "ccseq_name":"Test 30",
   "ccseq_status":"100000000",
   "ccseq_ccseq_expensetransactionset_ccseq_expensetransaction_ExpenseTransactionSetID":[
      {
         "ExpenseTransaction[ccseq_employeeid@odata.bind]":"/systemusers(6d2fd71b-32d1-dd11-a4f5-001a6449bbe7)",
         "ExpenseTransaction[ccseq_clientid@odata.bind]":"/ccseq_clients(663ebd00-73b9-4faf-90ed-f56bb9c2dc9b)"
      }
   ]
}

1 个答案:

答案 0 :(得分:0)

将请求正文修改为:

{
   "ccseq_importdate": "2017-06-05T04:00:00Z",
   "ccseq_month": "1",
   "ccseq_year": "2017",
   "ccseq_name": "Test 30",
   "ccseq_status": "100000000",
   "ccseq_employeeid@odata.bind": "/systemusers(6d2fd71b-32d1-dd11-a4f5-001a6449bbe7)",
   "ccseq_clientid@odata.bind": "/ccseq_clients(663ebd00-73b9-4faf-90ed-f56bb9c2dc9b)"
}