web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / DynamicsDevPro / {know-how} Set a lookup val...

{know-how} Set a lookup value on create/update of a record using MSCRM WebApi - An undeclared property Error

ram r Profile Picture ram r


Recently faced an error while creating and updating records in CRM using WebAPI. The issue was around setting a lookup value and following is the error message

An undeclared property new_primaryincident 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.


Fix:
The issue is due to the fact that whenever we set a lookup value we need use schema name and not the logical name. In my case I had to use "new_PrimaryIncident" instead of  "new_primaryincident".

Code snippet:

// code with issue
"new_primaryincident@odata.bind":"/incidents(10000000-0000-0000-0000-000000000000)"

// code after fix
"new_PrimaryIncident@odata.bind":"/incidents(10000000-0000-0000-0000-000000000000)"

Hope this helps!

This was originally posted here.

Comments

*This post is locked for comments