Query Multiple Lists In Nintex

Objective

You might be thinking why did Nintex not provide an option to query multiple lists. Let’s not worry about that... I have figured out a way to execute spsitedataquery. With this, we can fetch the items from the multiple lists.

Approach

In this demo, I will show how to fetch the Active Workflow task of a user from the multiple task lists.

Add Query List action to the Workflow design and open the configuration.



Query builder configuration allows only one list to select from the dropdown. Let's go-ahead to select a list. Here, I will select the Workflow tasks list and configure the filters & output fields (up to you).



Once the configuration is made to switch to CAML Editor mode, you will see the actual CAML query. This is the place , where we will change List Query to Site Query.

 
Update query, as described below.
  • Add <Webs Scope='SiteCollection' />
  1. <Webs Scope='SiteCollection' />  
  • Replace whole Lists tag with <Lists ServerTemplate='107'/>

    • 107 is the list template ID for Workflow tasks. For all Sharepoint List Server Template IDs, click here.
  1. <Lists ServerTemplate='107'/>  
  • If you like to query specific lists, add specific list ID, as shown below. 
  1. <Lists>
  2. <List ID='7A9FDBE6-0841-430a-8D9A-53355801B5D5' />  
  3. <List ID='3D18F506-FCA1-451e-B645-2D720DC84FD8' />  
  4. </Lists>  

That’s it. After the updates, the query should look, as shown below.

ServerTemplate

Specific Lists

 
Note

After editing the query, switching between Query builders and CAML Editor will void the custom changes. Thus, be cautious on this front. 

You can verify the query by clicking Run Now.

Hope you found this blog informative. Thank you.

Ebook Download
View all
Learn
View all