when I try to add\change the value of a custom lookup and then save it, I get this error:
Exception Message: Error identified in Payload provided by the user for Entity :'', For more information on this error please follow this help link https://go.microsoft.com/fwlink/?linkid=2195293 ----> InnerException : Microsoft.OData.ODataException: An undeclared property 'ey_org_unit_hr_id' 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.
at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadUndeclaredProperty(IODataJsonLightReaderResourceState resourceState, String propertyName, Boolean propertyWithValue)
at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadPropertyWithoutValue(IODataJsonLightReaderResourceState resourceState, String propertyName)
at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.<>c__DisplayClass9_0.<ReadResourceContent>b__0(PropertyParsingResult propertyParsingResult, String propertyName)
at Microsoft.OData.JsonLight.ODataJsonLightDeserializer.ProcessProperty(PropertyAndAnnotationCollector propertyAndAnnotationCollector, Func`2 readPropertyAnnotationValue, Action`2 handleProperty)
at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadResourceContent(IODataJsonLightReaderResourceState resourceState)
at Microsoft.OData.JsonLight.ODataJsonLightReader.StartReadingResource()
at Microsoft.OData.JsonLight.ODataJsonLightReader.ReadResourceSetItemStart(PropertyAndAnnotationCollector propertyAndAnnotationCollector, SelectedPropertiesNode selectedProperties)
at Microsoft.OData.JsonLight.ODataJsonLightReader.ReadAtStartImplementationSynchronously(PropertyAndAnnotationCollector propertyAndAnnotationCollector)
at Microsoft.OData.ODataReaderCore.ReadImplementation()
at Microsoft.OData.ODataReaderCore.InterceptException[T](Func`1 action)
at System.Web.OData.Formatter.Deserialization.ODataReaderExtensions.ReadResourceOrResourceSet(ODataReader reader)
at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)
at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger).
ErrorCode: -2147185383
HexErrorCode: 0x80048d19
the field's logical and schema name is "ey_org_unit_hr_id" (both of them are identical).
I opened the post request that the form sends and this is what I found:
{"[email protected]":"/ey_businessunits(91293b20-afb7-e611-bec8-0050568c00dc)",
"[email protected]":null,
"ey_s_name":"test555",
"ey_b_is_doctor_house":false,
"ey_b_is_route_service_requests":false,
"ey_b_real_branch":false,
"statuscode":1,
"statecode":0}
then I opened the metadata and found out that the NavigationalProperty Name of this field is different than what is used in the post request (ey_org_unit_hr_id is used in the request but the navigational property name is ey_ey_businessunit_ey_branch_hr which is also the name of the relationship).
Photo of the navigation property name
so i tried to send a post request using postman whith the currect NavigationProperty Name and it worked without an error. Here is the request:
{"[email protected]":"/ey_businessunits(91293b20-afb7-e611-bec8-0050568c00dc)",
"ey_ey_businessunit_ey_branch_hr@OData.Community.Display.V1.FormattedValue":null,
"ey_s_name":"test555",
"ey_b_is_doctor_house":false,
"ey_b_is_route_service_requests":false,
"ey_b_real_branch":false,
"statuscode":1,
"statecode":0}
I thought about changing the navigational property name to what is used in the original post request but I don't know if I can change the metadata.
Try this property name:
_ey_org_unit_hr_id_value.