James Houck James Houck - 26 days ago 13
Javascript Question

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.

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!


Answer Source

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:


Please note that you wil get an error about missing quantities if you only use this post message body.