0

I'm using a CQWP, and I need to add more than three filters. The filters I want are:

  1. Status is not equal to Completed
  2. Status is not equal to Deferred
  3. Due date is less than Today
  4. Assigned To is equal to Me

The filter Assigned To = [Me] in my CAML query, but it's not returning any results. All my other filters work so far. Here is my code:

    <property name="QueryOverride" type="string">
        <![CDATA[
            <Where>
                <And>
                    <And>
                        <And>
                            <Neq><FieldRef Name="Status" /><Value Type="Choice">Completed</Value></Neq>
                            <Neq><FieldRef Name="Status" /><Value Type="Choice">Deferred</Value></Neq>
                        </And>
                        <Lt><FieldRef Name="DueDate" /><Value Type="DateTime"><Today /></Value></Lt>
                    </And>
                    <Eq><FieldRef Name="AssignedTo" /><Value Type="Integer"><UserID Type="Integer" /></Value></Eq>
                </And>
            </Where>
        ]]>
    </property>

I have tested all my other filters, and they work. It's just the Assigned To that's not working. I have also tried removing all the carriage returns, but that did not help.

My Assigned To column is the default out-of-the-box Assigned To column when you create a Task list. It is showing Name (with presence), if that makes any difference.

Any ideas?

1 Answer 1

1

In CAML query try to set LookupID attribute to TRUE value in FieldRef element.

Replace

<FieldRef Name="AssignedTo" /><Value Type="Integer"><UserID Type="Integer" /></Value>

with

 <FieldRef Name="AssignedTo" LookupId="TRUE"/><Value Type="Integer"><UserID/></Value>
4
  • Tried it; did not work.
    – Trenton M
    Apr 11, 2014 at 14:08
  • Never mind. I had a space between UserID and the /, which was causing issues. Thanks!
    – Trenton M
    Apr 11, 2014 at 15:02
  • Glad it works! :) Apr 11, 2014 at 15:16
  • So another question, I want to group by results by Site. So this CQWP is rolling up tasks across all Sites, but I want them to be grouped by the site it's coming from. Any ideas? I also want it to display how the grouping shows up on the OOTB CQWP.
    – Trenton M
    Apr 11, 2014 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.