1
votes

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.

I am following the 2016 SDK documentation to a T, and for the most part, all of my POST and GET requests are working. 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.

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.

Thanks for any help!

-James

2
Can you post your POST requests? Portions of code where you bind the productid ?dynamicallyCRM
Yeah, it was a rookie move --- I had everything right except that I was trying to bind to the singular of uom - when I changed the syntax to "/uoms(uomGUID)" it worked like a charm. Thanks for the replies!James Houck

2 Answers

1
votes

This is the minimal post body that you need to create a quote product:

{
    "[email protected]": "/products(11c0dbad-91df-e311-b8e5-6c3be5a8b200)",
    "[email protected]" : "/quotes(69b5e1ae-037f-e611-80ed-fc15b428dcdc)",
    "[email protected]" : "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.

1
votes

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; ie: { "[email protected]" : "/uoms(GUID)" }