I had the following code:
QueryExpression query = new QueryExpression("fpis_jobsite") { ColumnSet = new ColumnSet { AllColumns = true } }; query.Criteria = new FilterExpression(); query.Criteria.AddCondition("fpis_name", ConditionOperator.Contains, siteName); EntityCollection entities = organizationService.RetrieveMultiple(query); return entities.Entities.Select(BuildJobSite).ToList();
Running it in a test gave me a Generic SQL Error.
After much fuss, I followed the instructions
here to run a SQL trace.
I found the following error:
"Cannot use a CONTAINS or FREETEXT predicate on table or indexed view 'fpis_JobSite' because it is not full-text indexed."
Once I changed the ConditionOperator.Contains operator in my condition to ConditionOperator.Like, the call executed without any further problems.
On a side note, it is not possible to populate child entities by calling RetrieveMultiple with a QueryExpression. You have to make seperate web service calls. In most cases though, you'd be able to craft your QueryExpression to retrieve all the child entities in a single call.
Le me an example for operator "Like" and the use of "%".
ReplyDeletethanks