Question

I'm using Microsoft's CRM software (4.0) and I'm trying to build a query expression. It works fine with querying only String values, but now I need to include a field that is of type CRMBoolean. I should also mention I'm querying custom entities.

So previously, in my query I would only search by a few fields, but they were all of type String. Now I need to add another ConditionExpression for a CRMBoolean. The type of custom entity I'm searching for has a field called "Condition" - which will either have a value of "true" or "false". In CRM the attribute is defined as a bit, but I didn't think that would make a difference.

Here is my code I'm trying to use to find records that have a condition of "true":

oCondition = New ConditionExpression()
oCondition.AttributeName = "myEntity_condition"
oCondition.Operator = ConditionOperator.Like

Dim bool As New CrmBoolean
bool.Value = True
oCondition.Values = New Object() {bool}

listConditions.Add(oCondition)

I don't get an error, but nothing really happens. The number of records that is returned never changes one way or another. Has anyone done this before?

Thanks in advance!

Was it helpful?

Solution

Instead of putting a CrmBoolean object in the oCondition.Values array, just put a regular true/false boolean. I would also concur with benjynito on changing it to ConditionOperator.Equals instead of Like.

OTHER TIPS

I don't know how the like operator is suppose to behave on a boolean. I wonder if its being ignored. Try ConditionOperator.Equal.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top