Filtering on related entities

Sep 26, 2013 at 12:57 PM
First of all.. is this even possible?

When filtering for something (ID for example) this works fine for me:
var  filter="(new_Event_Id/Id eq guid'"+id+"')";
However I have cases where I want to filter on a related entity.

I am using an expand query which brings back all the data OK. However if I try to filter by a column in the related data I get various errors. For a lookup column, I'm trying:
var filter="("+relationship_name+"/new_Event_Id/Id eq guid'"+id+"')";
If I don't include the final /Id it throws up a complex type error. /Id give me a fairly unhelpful error.. whereas adding in another field name there throws up an error that the field doesn't exist or whatever.

Anyone tried this? Anything I'm doing wrong?

Cheers!
Coordinator
Oct 1, 2013 at 8:50 AM
Hi kubaB,

I assume this kind of query is not possible with ODATA. For any kind of "complex" queries use the CrmFetchKit.js.

In terms of query-option is FetchXML much more powerful than ODATA.

Regards,

Daniel
Marked as answer by thuld on 11/12/2013 at 12:29 PM