How to Fix the Binary Operator with Incompatible Types WebApi Error in Dynamics 365

Leave a comment

In this post, we will look at how to fix the error “a binary operator with incompatible types was detected. Found operand types ‘Microsoft.Dynamics.CRM.account’ and ‘Edm.Guid’ for operator kind ‘Equal'”.

This error occurs when trying to access the WebApi. There are at least a couple of scenarios where this error can happen. Let’s look at these.

The first scenario is when you are trying to select a record by filtering the Id. For example, I have an account:

The URL of this account is:

We can see the Id is d2720425-53ad-43c3-b9dc-e7452b80ae13. To access this through the Web Api, we use below. Note the syntax – incorrect syntax may produce the error we are seeing:$select=name&$filter=accountid eq d2720425-53ad-43c3-b9dc-e7452b80ae13:

Next scenario, let’s say we want to select a record from our entity called new_accountbpf. A simple query gives us the results:

Now, the new_accountbpf entity has a field called bpf_accountid, which is a lookup to the Account field:

But, we can’t query this by passing an Account Id like we did above. E.g.$select=activestageid,bpf_accountid,businessprocessflowinstanceid&$filter=bpf_accountid eq d2720425-53ad-43c3-b9dc-e7452b80ae13

Will cause the error:

In order to query this, we need to use the format:$select=activestageid,bpf_accountid,businessprocessflowinstanceid&$filter=bpf_accountid/accountid eq d2720425-53ad-43c3-b9dc-e7452b80ae13

Where we’re appending to the lookup field the id name of what we’re querying.

This gives us the result we require:



Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube


Leave a Reply

Your email address will not be published. Required fields are marked *