Error : A binary operator with incompatible types was detected. Found operand types ‘Entity’ and ‘Edm.Guid’ for operator kind ‘Equal’.

I recently found this error while doing Xrm.WebApi.retrieveMultipleRecords() 

Requirement was to fetch multiple records based on related attribute.

So i am having GUID of related record.

Medical Record – Parent Entity,
Medical Record lines – Child Entity.
Also have downloaded the MetaData File.
To know how to get metadata file check my blog here

The Error wa because,
In Filter section

var filterOptions = "?$select=bupa_medicallineid&$filter=bupa_MedicalRecord eq '" + RecordId + "

I was using Navigation name, instead we have to used Web API Property Name.

var filterOptions = "?$select=bupa_medicallineid&$filter=_bupa_medicalrecord_value eq '" + RecordId + "

So, instead of providing Navigation Name, we have to provide property Name.

Hope it Helps

Thanks
Friyank 🙂

One thought on “Error : A binary operator with incompatible types was detected. Found operand types ‘Entity’ and ‘Edm.Guid’ for operator kind ‘Equal’.

  1. Thanks for saving me.
    I hate this inconcistency with Microsoft. If it’s a custom entity it needs _xxx_value but if it’s not a custom entity then xxx will suffice!

    Like

Leave a comment