Vadim Tabakman

For those that haven't used SharePoint Document Sets before, here's a good introduction to it : Introduction to Document Sets

In Nintex Workflow, to query for documents in a document set, you use a Query List action.

Query List Action

I've found the easiest way to do this, is to add a Query List action to your workflow, configure it by selecting a list that contains your document set then add a field that you want to extract (usually the ID field).  Finally, check the box to go into CAML Editor mode.

This is where you'll want to make some modifications to the CAML query.  First of all, you need to know your document set name that you want to query.  You don't need to know it as design time.  This value can come in from a workflow variable.  This is what you will be filtering on, as we want to find all the documents within the document set, the filter will be based on the ServerUrl of each document and to make sure it contains the following /[docsetname]/.  Notice the forward slashes.

One final thing to note, is that document sets are very similar to folders in a library.  Therefore, in order to have a CAML query look further than just the root of the library, you need to change the scope and tell it to look recursively.

In my test, I had a document set named DocSet, which resulted in the following CAML query.

  
    
  
  
    
  
  
    
      
<Query>
  <Lists>
    <List ID="{617645D0-A8F2-4D77-912F-E82A12EF06E6}"/>
  </Lists>
  <ViewFields>
    <FieldRef Name="ID"/>
  </ViewFields>
  <Where>
    <Contains>
      <FieldRef Name="ServerUrl"/>
      <Value Type="Computed">/DocSet/</Value>
    </Contains>
  </Where>
  <ViewAttributes Scope="Recursive"/>
</Query>

Query List Configuration

You can test this out by putting that into a Query List action and clicking on the Run Now button to make sure you get the results you need.

Conclusion

There is a possible issue with this query.  If you multiple document set, eg DocSet, DocSetA and DocSetB, and you have a folder or a document set within a document set with the same name, it will find those also. 

The workaround, would be to have a longer ServerUrl that you compare to. eg /[listname]/[docsetname]/.

Gravatar
Posted by Vadim Tabakman Thursday, August 1, 2013 7:13:00 AM Categories: Nintex Nintex Workflow Nintex Workflow 2013 Query List
Copyright Vadim Tabakman
Rate this Content 0 Votes

Comments

Tuesday, August 6, 2013 2:31:47 AM
Peter

re: Nintex Workflow - Querying a Document Set

Hey Vadim,

nice tutorial, thank you :)

But in my tests I've got a problem. I run the query immediatelly after creating the Doc Set (I've added an Excel-Sheet as default content for it and I need it's ID) and sometimes it seems that the workflow queries too fast - it does not return an ID for the document. But other times it does...

Do you have any ideas how to solve this issue?

Many Thanks

Peter

Thursday, August 22, 2013 4:01:37 PM

re: Nintex Workflow - Querying a Document Set

Hi Peter,

you may want to put in a Delay/Pause action and set it for a few minutes, to give it some time to complete it's process.

cheers,

Vadim

Wednesday, September 11, 2013 1:13:07 PM
Rebecca

re: Nintex Workflow - Querying a Document Set

I do not see "ServerUrl" as a valid option for a filter. I can see it as a valid selection in the "Field" section, but on in the filter section, which is where I see you put it. It's not retrieving any results, even though I know I have documents in my document set.

Wednesday, September 11, 2013 3:00:44 PM
Rebecca

re: Nintex Workflow - Querying a Document Set

OK, I see where I messed up. You put the actual name of the document set in the above CAML query. I can't seem to do that dynamically? The requirement is that for each document set, there could be a # of documents a given set of reviewers (provided at the document set content type level) needs to be reviewing. The workflow needs to be the same for all document sets created of that content type, but they will all be named differently. I have tried to put the name reference in variables, directly in the CAML query, in the query builder, etc. Nothing seems to get back information unless I put the literal name of my test document set. Please help, if possible. I'm going to keep trying to find a solution, but assistance would be very appreciated.

Wednesday, September 11, 2013 3:17:48 PM
Rebecca

re: Nintex Workflow - Querying a Document Set

And, once again, I messed up Embarassed. I was attempting your suggestion with the list name (because I may have similar document set names), but I was pulling the list name dynamically from the common variables. BUT - when I created the list, I removed a space (to get a good URL for the list) and then I changed it afterwards to add a space. The dynamic variable I was using was pulling the actual List Name, not the part of the URL that I needed.

All works GREAT now!

Thanks!

Wednesday, September 11, 2013 3:29:40 PM

re: Nintex Workflow - Querying a Document Set

Hi Rebecca,

that's so awesome.  I'm so glad you found what it was and have it working:)

cheers,

Vadim

Tuesday, April 8, 2014 8:49:06 AM
Ashani
Gravatar

re: Nintex Workflow - Querying a Document Set

Dear Vadim ,

i have one question  Sometime (not every time) fetches #number;itemname while quering in lookup list using Nintex .
I wondering why this is happening with only few recordes?
Can you help or suggest ?
Thanks
->Ashani

Tuesday, April 8, 2014 9:07:04 AM

re: Nintex Workflow - Querying a Document Set

Hi Ashani,

I'm afraid I don't know the answer to that.  The query is simply running a CAML query behind the scenes and that is the data that is coming back.  I don't know why it only does that sometimes.

cheers,

Vadim

Thursday, September 25, 2014 3:59:34 AM
A. Aboustif
Gravatar

re: Nintex Workflow - Querying a Document Set

Hallo Vadim,

I have this Error "One or more field types are not installed properly. Go to the list settings page to delete these fields."

Do you have any Idea to fix that?

 

Cheers

Ahmad

Thursday, September 25, 2014 8:19:35 AM

re: Nintex Workflow - Querying a Document Set

Hi Ahmad,

unfortunately, that error from SharePoint is a little vague.  I've seen it occur if there's something not quite right with the configuration of a Query List action though.

cheers,

Vadim

You must sign in to this site to post comments.
Already Registered?
Sign In
Not Yet Registered?
Register

Statistics

  • Entries (279)
  • Comments (1769)

Categories