Following code illustrate how to Filter the data in the CRM and retrieve data from it in following code I have Select "Paidamount " form "Eventbooking" Entity for that I need to satisfy following criteria
PaidAmount should not null, Bookingstatus should be 2, StatusCode should be 1 and event id must have to equal to provide one of the top
PaidAmount should not null, Bookingstatus should be 2, StatusCode should be 1 and event id must have to equal to provide one of the top
// Enter Guid of Event Guid eventId = new Guid('46835C46-C059-422D-BF94-F4507ECE0F14') FilterExpression filter = new FilterExpression(); // Check Eventid == eventId; ConditionExpression condition = new ConditionExpression(); condition.AttributeName = "Eventid"; condition.Operator = ConditionOperator.Equal; condition.Values.Add(eventId); filter.AddCondition(condition); // Check Paidamount != null; condition = new ConditionExpression(); condition.AttributeName = "Paidamount"; condition.Operator = ConditionOperator.NotNull; filter.AddCondition(condition); // Check booktatus== 2; condition = new ConditionExpression(); condition.AttributeName = "booktatus"; condition.Operator = ConditionOperator.Equal; condition.Values.Add(2); filter.AddCondition(condition); // Check statuscode== 1; condition = new ConditionExpression(); condition.AttributeName = "statuscode"; condition.Operator = ConditionOperator.Equal; condition.Values.Add(1); filter.AddCondition(condition); // Set QueryExpression for Eventbooking QueryExpression query = new QueryExpression("Eventbooking"); // Select Paidamount Field query.ColumnSet = new ColumnSet("Paidamount"); // Add filter to query query.Criteria.AddFilter(filter); // Retrive Paidamount List var actualEventIncome = RetrieveMultiple(query).ToList();
0 comments:
Post a Comment