Skip to main content
Author Palesa Sikwane
Long Description

Do you need to scan through a SharePoint Sites contents and apply some logic based on the existence of a content type? Or maybe even go as far as scheduling this? Then this post is for you!

Dependencies
  • Nintex® Workflow 2010
  • Nintex® Workflow 2013
  • or Nintex® Workflow 2016

 

**And the applicable SharePoint® version for the Nintex® Workflow versions above. 

Support Info

Palesa Sikwane

Additional Information

N/A

Product used

Nintex® Workflow 2016 | Version: 4.2.0.10 - International

 

10219680-291443734_6-s4-v1.png?transparent=1&palette=1

Greetings from a warm and sunny side of Johannesburg, South Africa! It's finally Spring time in this side of the world!

 

10212616-291443734_6-s4-v1.png?transparent=1&palette=1

First things first, I would like to thank Michelle Barker‌ for coming up with this question and requirement!

 

 

As you guys would know, reusable workflows have the following properties:

  • Are associated with SharePoint® Content Types
  • Because they are linked to a content type, they can be made available wherever those content types are used in a site collection


Some of the advantages of using a reusable workflow are:

  • Having one Central place to make changes and publish a workflow and push it down to every list or document library
  • Making use of site templates that have content types with workflows linked to them

 

Some of the disadvantages of reusable workflow:

  • Inability to schedule a reusable workflow out of the box
  • Cannot be tied to a site workflow meaning that you cannot really schedule it using a site workflow. 

 

10222419-291443734_6-s4-v1.png?transparent=1&palette=1

What if then you were faced with a requirement that needs you to run a scheduled workflow based on a content type which could span across different lists and libraries? Maybe you have a requirement to send out reminder(s) at a certain frequency for certain document types? 

 

How would you go about it?

9936640-291443734_6-s4-v1.png?transparent=1&palette=1

Well there is a way that involves:

 

1. Finding all of your lists on your site

2. Getting all linked content types for each list

3. Per content type, Switch and apply your logic.

 

10153476-291443734_6-s4-v1.png?transparent=1&palette=1

I built this using the following site workflow:

 

Step # Workflow Action Description
1.

Call web service action (Get List Collection - Internal Names)

207970_pastedImage_1.png

  • This step involves calling the GetListCollection SharePoint webservice:
    • This allows us to get a collection of all the Lists and Libraries in our current site. The collection will store the InternalName of our lists, or what some of you might refer to as the GUID.
  • I've configured this workflow action as follows:

    Configuring Get List Collection Webservice to get the InternalName

 

Note: I've configured this to actually return the InternalName of my lists or the GUIDs in a collection variable called ListCollection. You will see how and where we use this later...

2. Collection Operation
207986_pastedImage_2.png

Here I simply count how many lists are in my collection and store this in a variable called No Lists:

 

207994_pastedImage_2.png

 

207995_pastedImage_3.png


Note: Note that I also log my result within the same action.

3.  For Each
207987_pastedImage_3.png

This is my first For Each where I basically loop through my ListCollection I retrieved in Step 1, and store the InternalName or the GUID of each list in a variable called ListGUID. The configuration is as follows:

 

207996_pastedImage_5.png

3.1

Log in history list

207988_pastedImage_4.png

Here I basically log the current lists index in my collection(ListCollection) as well as the ListGUID:

207997_pastedImage_6.png

3.2

Call web service (Get List Content Types)

207989_pastedImage_5.png

Next, I call another SharePoint Web Service called GetListContentTypes based on the current ListGUID that my For Each in Step 3 is looking at.

 

I then store the results in a collection variable called List Content Types. This step is configured as follows:

 

207998_pastedImage_1.png

Note: The results returned here are in XML, and one of the NODES in the XML contain the Name of the content type, which is what we want

3.3

Query XML

207990_pastedImage_6.png

Seen that in Step 3.2 I get returned some XML, I simply query the XML in this step to get the Display Name of my content types and store these in a collection variable called Content Type Names. I've configured this step as follows:

207999_pastedImage_3.png

4

For each

207987_pastedImage_3.png

This is my second For Each; which allows me to iterate through each content types name stored in my collection Content Type Names:

208000_pastedImage_5.png

4.1

Log in history list

207988_pastedImage_4.png

Here I simply log the name of my content type:

208001_pastedImage_6.png

4.2

Switch (per content type)

207991_pastedImage_7.png

Note that I haven't put this in my workflow, but this is where the magic happens for you guys. 

 

So because we've found content types for any list or library across our site with the previous steps, we can use a conditional action such as a Switch to put in some workflow logic as required per content type! 

 

Running this workflow will give you the following result in your workflow history:

208002_pastedImage_12.png

So as you can see my Workflow scans the current site, and for each list and library returns the associated content types. 

8813497-291443734_6-s4-v1.png?transparent=1&palette=1


Feel free to download this and play around with it, and do what you will with it happy.png  Maybe even make it a User Defined Action? wink.png 

 

Let us know how you guys used this!

 

I hope this helps someone out there! 


Cheers

 

7196007-291443734_6-s4-v1.png?transparent=1&palette=1

Very useful and simple


Reply