QueryExpression

This class can be used to create a query for a complex scenario where we have multiple conditions. It supports both the AND and OR logical operators. We can retrieve data from the related entity using the QueryExpression class. For example, if we want to write the preceding QueryByAttribute query, where we used QueryExpression, we could use the following code:

QueryExpression query = new QueryExpression() {
EntityName = "him_make",

In the following code, we have defined conditions using Criteria:

 ColumnSet = new ColumnSet(new string[] {
"him_name"
}),
Criteria = {
Filters = {
new FilterExpression {
FilterOperator = LogicalOperator.And,
Conditions = {
new ConditionExpression("him_name", ConditionOperator.Equal, "Tata")
},
}
}
}
};

In Criteria, we can define filter conditions.

Now that we know how to query Dynamics 365 CE entities using QueryExpression, let's discuss how to create an entity record using the Create method.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset