Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Test for a null value

Test for a null value

Applies To: CRM 2015 on-prem, CRM Online

The following code example shows how to test for a null value by using the FilterExpression and QueryByAttribute classes.

Use this code to test for equality by using the FilterExpression class.

FilterExpression null_filter = new FilterExpression(LogicalOperator.And); 
null_filter.FilterOperator = LogicalOperator.And; 
null_filter.AddCondition("leadid", ConditionOperator.Null);

Use this code to test for inequality by using the FilterExpression class.


FilterExpression filter = new FilterExpression(LogicalOperator.And); 
filter.FilterOperator = LogicalOperator.And; 
filter.AddCondition("leadid", ConditionOperator.NotNull);

Use this code to test for equality by using the QueryByAttribute class.


QueryByAttribute qba = new QueryByAttribute("account"); 
qba.ColumnSet = new ColumnSet("name","address1_stateorprovince"); 
qba.AddAttributeValue("donotfax", null);

See Also

Microsoft Dynamics CRM 2015 and Microsoft Dynamics CRM Online
Send comments about this topic to Microsoft.
© 2015 Microsoft. All rights reserved.
Show:
© 2015 Microsoft