CRM 2015 Basic QueryExpression

Unfortunately you specify fields/links/conditions/orders manually. Be careful for typos.


        public EntityCollection GetDetails(Guid Id, IOrganizationService service)
        {
            QueryExpression getData = new QueryExpression("new_warrantyclaimproduct"); //entityname
            getData.NoLock = true;
            getData.ColumnSet = new ColumnSet(true); // true turns all columns, otherwise you need to specify field names "a","b"
            getData.Criteria.AddCondition("new_warrantyclaim", ConditionOperator.Equal, Id);
            getData.AddOrder("new_linenum", OrderType.Ascending);
            EntityCollection result = service.RetrieveMultiple(getData);
            return result;
        }

Leave a Reply

Your email address will not be published. Required fields are marked *