Symptom
You receive the error "Error in filter System Query, Operation failed::Operands of logical operator '' are not valid" when executing a GET for a query using "OR" operator.
Environment
SAP Cloud for Customer
Reproducing the Issue
- Perform a GET call for a query in the following format:https://myXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/IndividualCustomerCollection?$filter=PartyID eq 'ABC' or CustomerID eq 'XYZ'
- Result: The error "Error in filter System Query, Operation failed::Operands of logical operator '' are not valid" is displayed.
Cause
Logical OR only works for the same property. In this case, it is used two properties in the query (CustomerID and PartyID), which is not supported.
Resolution
As a workaround, each or segment can be executed as a separate query, and the results can be collated. E.g. : 1st Query - " ...$filter=PartyID eq '1001'" 2nd Query - "$filter=CustomerID eq 'CA'". In order to reduce round trips to the server, multiple queries can be executed as part of a $batch query.
See Also
Keywords
Odata, Query, Logical Operator, Operation failed, OR , KBA , LOD-CRM-INT-API , OData API (C4C Only) , How To