Home

Feb 19, 2013

CRM 2011 | Simple Query Expression using inline query

It might be very common nowadays to write inline class declaration, thought it would be helpful for someone who wants  to reduce the line of code and not aware of inline declaration J
QueryExpression query = new QueryExpression
{
    EntityName = Constants.Account.EntityLogicalName,
    ColumnSet = new ColumnSet(Constants.Account.OfficerId, Constants.Account.SalesId),
    Criteria = new FilterExpression
    {
        FilterOperator = LogicalOperator.And,
        Conditions =
                   {
                   new ConditionExpression
                    {
                        AttributeName = Constants.Account.CommissionId,
                        Operator= ConditionOperator.Equal,
                        Values = {commissionId}
                    }
                   }
    },
};
 

No comments: