Set Lookups in Xrm.WebApi D365 v9 correctly
Using Xrm.WebApi needs you to be careful with the field names and what to use when. Especially, when you are dealing with Lookups.
One of the most common errors you’ll come across is the one like below – “An undeclared property (fieldname you entered) which only has property annotations in the payload but no property value was found in the payload.”

This is confusing as to what needs to be put in while setting the lookup.
If you have done the below, entered the name of the field which is all in small caps –
object[“msdyn_resourcerequirement@odata.bind”] = “/msdyn_resourcerequirements(<Guid>)”;
This will result in the above error!!!
You’ll need to put the Schema name of the lookup field instead and this should solve your problem –

and the code should look like this –
object[“msdyn_ResourceRequirement@odata.bind”] = “/msdyn_resourcerequirements(<Guid>)”;
And this should totally work for you!!
Hope this helps! 🙂
Related posts:

Resolving SSL/TLS Secure Channel Trust Errors in Dynamics 365 Finance and Operations

How to change a Bill of material (BOM) item on a production order
![Shopify Meets Dynamics 365 Finance and Operations: A Guide to Integration [Part 2]](https://www.cloudfronts.in/wp-content/uploads/2024/12/DALL·E-2024-12-14-12.29.44-A-professional-illustration-depicting-the-integration-between-Shopify-and-Dynamics-365-Finance-and-Operations.-The-image-shows-Shopify-on-one-side-wit-150x150.webp)
Shopify Meets Dynamics 365 Finance and Operations: A Guide to Integration [Part 2]
![Shopify Meets Dynamics 365 Finance and Operations: A Guide to Integration [Part 1]](https://www.cloudfronts.in/wp-content/uploads/2024/12/DALL·E-2024-12-14-12.29.44-A-professional-illustration-depicting-the-integration-between-Shopify-and-Dynamics-365-Finance-and-Operations.-The-image-shows-Shopify-on-one-side-wit-150x150.webp)
