2

I made a query that gets all reports from CRM that have certain user guid or are due on today. So the equivalent if statement would be:

if(ownerid == userGuid || novemo_date == today) {...}

How can I make this kind of query:

if(ownerid == userGuid && (novemo_date == today || novemo_date == yesterday)){...}

This is my query:

var query = "<a:ColumnSet>" +
                            "<a:AllColumns>true</a:AllColumns>" +
                            "</a:ColumnSet>" +
                        "<a:Criteria>" +
                          "<a:Conditions />" +
                          "<a:FilterOperator>Or</a:FilterOperator>" +
                          "<a:Filters>" +
                            "<a:FilterExpression>" +
                              "<a:Conditions>" +
                              "<a:ConditionExpression>" +
                                  "<a:AttributeName>ownerid</a:AttributeName>" +
                                  "<a:Operator>Equal</a:Operator>" +
                                  "<a:Values xmlns:b='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>" +
                                    "<b:anyType i:type='c:string' xmlns:c='http://www.w3.org/2001/XMLSchema'>" + userGuid + "</b:anyType>" +
                                  "</a:Values>" +
                                "</a:ConditionExpression>" +
                                "<a:ConditionExpression>" +
                                  "<a:AttributeName>novemo_date</a:AttributeName>" +
                                  "<a:Operator>Equal</a:Operator>" +
                                  "<a:Values xmlns:b='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>" +
                                    "<b:anyType i:type='c:string' xmlns:c='http://www.w3.org/2001/XMLSchema'>" + today + "</b:anyType>" +
                                  "</a:Values>" +
                                "</a:ConditionExpression>" +
                              "</a:Conditions>" +
                              "<a:FilterOperator>Or</a:FilterOperator>" +
                              "<a:Filters />" +
                            "</a:FilterExpression>" +
                          "</a:Filters>" +
                        "</a:Criteria>" +
                        "<a:Distinct>false</a:Distinct>" +
                        "<a:EntityName>novemo_timereport</a:EntityName>" +
                        "<a:LinkEntities />" +
                        "<a:Orders />" +
                        "<a:PageInfo>" +
                          "<a:Count>0</a:Count>" +
                          "<a:PageNumber>0</a:PageNumber>" +
                          "<a:PagingCookie i:nil='true' />" +
                          "<a:ReturnTotalRecordCount>false</a:ReturnTotalRecordCount>" +
                        "</a:PageInfo>" +
                        "<a:NoLock>false</a:NoLock>";
ddelic
  • 89
  • 13
  • I managed to filter results by going through retrieved records and comparing it's ownerid attribute with userGuid and removing records that do not match from the array. If there is someone that has experience with these kinds of queries I will be more than grateful for sharing the knowledge... Regards! – ddelic Jun 08 '16 at 13:51

1 Answers1

1

Use SOAP logger, you can then write your logic in C# and the logger will output the request/response XML for you.

dynamicallyCRM
  • 2,980
  • 11
  • 16