Not all columns retrieved on `new ColumnSet(true)` in a plug-in
-
14-07-2021 - |
Question
I'm building the following query. For some reason, it doesn't bring to me all the fields. I've checked the spelling and when I assign values to those field, I even switched the name, leading to an exception. So I know for sure that they exist and are used. I'm adding a pre-image to the update-step with all data, just to be sure.
QueryExpression request = new QueryExpression
{
EntityName = "myLogicalName",
ColumnSet = new ColumnSet { AllColumns = true },
Criteria =
{
Filters =
{
new FilterExpression
{
FilterOperator = LogicalOperator.Or,
Conditions =
{
new ConditionExpression("someField", ConditionOperator.NotEqual, someValue),
new ConditionExpression("someField", ConditionOperator.Equal, somValue)
}
}
}
}
};
EntityCollection result = Service.RetrieveMultiple(request);
What can I be possibly missing?!
Solution
Its probably because; the field does not have a value or field level security is being applied.
As a side generally you should avoid using AllColumns = true
OTHER TIPS
Setting the AllColumns
property to true is essentially the same as doing a Select *
in sql. The columns won't be adding to the ColumnSet, but they will be returned in the results of your query expression.