in SharePoint 2010

Filter Content Query Web Part based on page field value and query string

I wanted to blog about this excellent feature in SharePoint 2010 CQWP for quite a long time and here it is.

Can I filter my CQWP based on a field’s value in the current page?

YES! You can in SharePoint 2010 Smile

What’s the use?

Well, simple example would be that you want a related items web part, like – related news, related staff members.

Stop talking, show me an example?

Here is my staff page:


What we are missing is a web part to show the related members of the Photography department, which is nothing but the current page’s Department value – Photography.

Configuring the CQWP

It is very simple to configure the CQWP to filter based on the page field value. Construct the query in the Additional Filters options:


The key thing is to understand the token format:

[PageFieldValue: <field-display-name>]

PageFieldValue token will filter the items based on a current page’s field value. The query above will fetch me all the items whose Staff Department is Photography (in this example) and adding Title not equal to current page’s Title vale will eliminate the current item appearing in the results.

and here is our web part:


Job done!

BTW, my example is running in Office 365 beta! Smile

Can I use query string to filter?

Yes, you can! Just use the PageQueryString instead.

Write a Comment


Time limit is exhausted. Please reload the CAPTCHA.

  1. Hello.
    I have Manage Metadata Menu, target page from this menu (isTermPage=true).
    Can I set up filter in CQWP by current page TermID?

    With best regards.