0

I am new in sharepoint development, Can anyone please help me find an error in this query?

I am using javascript to retrieve records. The where clause is based on status and priority fields.

Query I am using:

'<View><ViewFields>' +
                '<FieldRef Name=\'ID\'/>' +
                '<FieldRef Name=\'Priority\'/>' +
                '<FieldRef Name=\'Author\'/>' +
                '<FieldRef Name=\'LodgementDate\'/>' +
                '<FieldRef Name=\'Status\'/>' +
                '</ViewFields>' +
                '<Query><Where><And><Or><Or><Eq><FieldRef Name=\'Status\'/>' +
                '<Value Type=\'Text\'>Lodged</Value></Eq>' +
                '<Eq><FieldRef Name=\'Status\'/><Value Type=\'Text\'>Reassigned</Value></Eq></Or>' +
                '<Eq><FieldRef Name=\'Status\'/><Value Type=\'Text\'>Acknowledged</Value></Eq></Or>' +
                '<And><And>' +
                '<And><Eq><FieldRef Name=\'Priority\'/><Value Type=\'Text\'>High</Value></Eq><Lt><FieldRef Name=\'LodgementDate\'></FieldRef><Value Type=\'DateTime\'><Today OffsetDays=\'-1\'/></Value></Lt></And>' +
                '<And><Eq><FieldRef Name=\'Priority\'/><Value Type=\'Text\'>Medium</Value></Eq><Lt><FieldRef Name=\'LodgementDate\'></FieldRef><Value Type=\'DateTime\'><Today OffsetDays=\'-3\'/></Value></Lt></And>' +
                '</And>' +
                '<And><Eq><FieldRef Name=\'Priority\'/><Value Type=\'Text\'>Low</Value></Eq><Lt><FieldRef Name=\'LodgementDate\'></FieldRef><Value Type=\'DateTime\'><Today OffsetDays=\'-7\'/></Value></Lt></And>' +
                '</And>' +
                '<Eq><FieldRef Name=\'Author\' LookupId=\'TRUE\'></FieldRef><Value Type=\'Integer\'><UserID Type=\'Integer\'/></Value></Eq>' +
                '</And></Where></Query>' +
                '<RowLimit>1000</RowLimit></View>'

An error I am getting:

Cannot complete this action.

0

Try this:

        '<View>'+
            '<ViewFields>' +
                '<FieldRef Name=\'ID\'/>' +
                '<FieldRef Name=\'Priority\'/>' +
                '<FieldRef Name=\'Author\'/>' +
                '<FieldRef Name=\'LodgementDate\'/>' +
                '<FieldRef Name=\'Status\'/>' +
            '</ViewFields>' +
            '<Query>'+
                '<Where>'+
                    '<And>'+
                        '<Or>'+
                            '<Or>'+
                                '<Eq><FieldRef Name=\'Status\'/><Value Type=\'Text\'>Lodged</Value></Eq>'+
                                '<Eq><FieldRef Name=\'Status\'/><Value Type=\'Text\'>Reassigned</Value></Eq>'+
                            '</Or>'+
                            '<Eq><FieldRef Name=\'Status\'/><Value Type=\'Text\'>Acknowledged</Value></Eq>'+
                        '</Or>'+
                        '<And>'+
                            '<And>'+
                                '<And><Eq><FieldRef Name=\'Priority\'/><Value Type=\'Text\'>High</Value></Eq><Lt><FieldRef Name=\'LodgementDate\'></FieldRef><Value Type=\'DateTime\'><Today OffsetDays=\'-1\'/></Value></Lt>'+
                                     '<Eq><FieldRef Name=\'Priority\'/><Value Type=\'Text\'>Medium</Value></Eq><Lt><FieldRef Name=\'LodgementDate\'></FieldRef><Value Type=\'DateTime\'><Today OffsetDays=\'-3\'/></Value></Lt></And>'+
                                '<And><Eq><FieldRef Name=\'Priority\'/><Value Type=\'Text\'>Low</Value></Eq><Lt><FieldRef Name=\'LodgementDate\'></FieldRef><Value Type=\'DateTime\'><Today OffsetDays=\'-7\'/></Value></Lt></And>'+
                            '</And>'+
                            '<Eq><FieldRef Name=\'Author\' LookupId=\'TRUE\'></FieldRef><Value Type=\'Integer\'><UserID Type=\'Integer\'/></Value></Eq>'+
                        '</And>'+
                     '</And>'+
                 '</Where>'+
            '</Query>'+
            '<RowLimit>1000</RowLimit>'+
        '</View>'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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