I\'m trying to get a list of cases whose AccountID is found in a previous list.
The error occurs on the last line of the following:
// Gets the list of p
The problem is the CRM Linq Provider. It doesn't support all of the available options that the Linq-to-objects provider offers. In this case, the CRM does not support the Enumerable.Contains()
method.
where: The left side of the clause must be an attribute name and the right side of the clause must be a value. You cannot set the left side to a constant. Both the sides of the clause cannot be constants. Supports the String functions Contains, StartsWith, EndsWith, and Equals.
You can work around this in one of two ways:
OR
clauses on each item in customerIDs
. This would function similarly to Enumerable.Contains
.See my answer or the accepted answer to the question "How to get all the birthdays of today?" for two separate ways to accomplish this.