Hello team,
A very quick note to remind you about something really important when working with the Dynamics Web API, it is one of those things that you always forget to check until you spent 3 hours trying to figure out why it isn’t working.
I was updating my code to create some related records after creating a contact record and in one of the related entities I got this error:
“An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property ‘YOUR FIELD’ which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.”
This is caused because in my request I had the wrong field name, please remember always use the schema name for the lookups!
It is quite common for different people to create the fields in an entity and as I am sure you know Dynamics 365 tends to keep the characters in Capitals when it maps the schema name:
Some people would correct this and leave the schema name to be: mif_myfield
Others will just leave it like that.
Personally I tend to correct it and leave everything lower case but whatever works for you.
So my issue with my request was that I was using the Name of the field rather than the Schema Name:
This is wrong:
This is correct:
Changed that to use the schema name and everything started working perfectly 😊
Thanks,
Mario
Hi,
In my case, I’m struggling to associate a Price List with the created Order record. I’m using the below. Is this correct?
dataObject[“_pricelevelid_value@odata.bind”] = “/pricelevels(” + priceListValue + “)”;
Hello Priyesh,
You can’t directly update the value objects. Something like this should work:
dataObject[“pricelevelid@odata.bind”] = pricelevels(pricelevelid);
The first pricelevelid is the lookup field name, the second one is the Guid
Let me know how it goes!
Thanks,
Mario
Hi Mario,
I have the same issue when I try to update any lookup of an activity entity. Is there anything other I need to add for lookups on activities or is it a bug?
I have no problem updating partylist fields on activities.
I have no problem updating lookups on any normal entity(custom and oob).
Even tried using CRM REST Builder. but I get the same error.
Regards,
Kaloyan
Thank you so much for posting this! I’m new to Dynamics CRM and its API, and was stuck on updating a relationship via an API call. This post was exactly what I needed to correct my problem and get my Monday off to a good start. Thank you!
Welcome to Dynamics!! Happy to help!! Have a great rest of the week!
Thanks for posting this, it helped me and saved me lot of time :).