简体   繁体   English

使用新的Web API和JavaScript POST在Dynamics CRM 2016中创建QuoteProduct

[英]Create QuoteProduct in Dynamics CRM 2016 using new Web API and JavaScript POST

I am running into an issue setting the Existing Product field on a new Quote Product record in Microsoft Dynamics CRM 2016 on-prem using the new Web API. 我在使用新的Web API在Microsoft Dynamics CRM 2016内部部署中在新报价产品记录上设置“现有产品”字段时遇到问题。

I am following the 2016 SDK documentation to a T, and for the most part, all of my POST and GET requests are working. 我将2016 SDK文档放在T后面,并且在大多数情况下,我所有的POST和GET请求都可以正常工作。 I am aware of using the @odata.bind syntax for setting lookups, however, while I CAN create a Quote Product entity setting the parent QuoteId with the GUID, for whatever reason, the POST will not complete when I try to set the productid value in the same manner as the quoteid. 我知道使用@ odata.bind语法设置查找,但是,尽管我可以创建一个使用GUID设置父QuoteId的Quote Product实体,但是由于任何原因,当我尝试设置productid值时,POST都不会完成以与quoteid相同的方式。

Has anyone else been successful with this? 其他人成功了吗? I've looked over all of the values in in the CRM db for the QuoteDetail table and tried setting them all the same as existing records, but keep getting hung up on the productid. 我查看了CRM数据库中QuoteDetail表的所有值,并尝试将它们设置为与现有记录相同,但是一直挂在productid上。

Thanks for any help! 谢谢你的帮助!

-James -詹姆士

This is the minimal post body that you need to create a quote product: 这是创建报价产品所需的最少的正文:

{
    "productid@odata.bind": "/products(11c0dbad-91df-e311-b8e5-6c3be5a8b200)",
    "quoteid@odata.bind" : "/quotes(69b5e1ae-037f-e611-80ed-fc15b428dcdc)",
    "uomid@odata.bind" : "uoms(73a5daea-6ddc-e311-a678-6c3be5a8c0e8)"
}

And this is the url I'm using: 这是我正在使用的网址:

https://tenantname.api.crm.dynamics.com/api/data/v8.1/quotedetails

Please note that you wil get an error about missing quantities if you only use this post message body. 请注意,如果仅使用此帖子正文,则会丢失数量错误。

As @Martijin Eikelenboom pointed ot in his answer, you need to be sure to add the plural for unit of measure in your syntax when you specify the entity type; 正如@Martijin Eikelenboom在回答中指出的那样,当您指定实体类型时,您需要确保在语法中添加度量单位的复数。 ie: { "uomid@odata.bind" : "/uoms(GUID)" } 即:{“ uomid@odata.bind”:“ / uoms(GUID)”}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM