Hi Friends,
I am struggling to update lookup fields using XRM.WEBAPI for custom entity.
I have web resource and i used JQgrid to show and update related records, Lookup is one of the field inside grid.
The lookup field "Topics" on entity "Query"(web resource has topics grid) , my requirement is to update this field using WEBAPI.
I got the below error:
An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'kv_TopicAsk' 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__DisplayClass4_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.ReadResourceStart(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)
As per documentation given my Microsoft i tried the same but it is not working.

I tried both, Schema name , logical name, post-fix with underscore related entity schema name but no luck.....
var data = { schemaName@odata.bind": "/relatedentity plural(31a0r5b9-88df-e511-b8e5-6c3be5a8b200)" }
var data = { logicalName@odata.bind": "/relatedentity plural(31a0r5b9-88df-e511-b8e5-6c3be5a8b200)" }
var data = { logicalName_relatedenity@odata.bind": "/relatedentity plural(31a0rb9-88df-e511-b8e5-6c3be5a8b200)" }
Please let me now if you have faced the same and got any solution.
Rregards,
Santosh