Skip to main content

Notifications

How to fix getting “Undeclared Property Error” when using Lookups with Dynamics 365 Web API

Mario Trueba C Profile Picture Posted by Mario Trueba C 156

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:

postmanerror

“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!

contactinfo

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:

myfieldinformation

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:

incorrectrequest

This is correct:

correctrequest

Changed that to use the schema name and everything started working perfectly

Thanks,

Mario

 

 

 

Categories:

Comments

*This post is locked for comments