Today, I was asked about triggering a flow only when a document set is created.

I started by enabling Document sets on my site. (note that this is a site collection feature that you need to enable)

Then I created my flow that triggers on the creation or modification of a file. And I’m initialising a variable with the content type Id of the document set that was added:

Microsoft Flow - Get your flow to trigger on the creation of a Document Set Microsoft Flow, Microsoft Office 365 contenttypeid

Most of the hard work has now been done. I could now add a condition that checks for the Content type Id to start with 0x0120D520.

But this means that my flow will kick off and I would end it immediately. This is a waste of my number of flow runs. So I would pay for these flows to run even though I don’t want them to run.

It would be nice if triggers could handle filters like in the Get Files action where a Filter Query can be configured.

Microsoft Flow - Get your flow to trigger on the creation of a Document Set Microsoft Flow, Microsoft Office 365 getfiles

 

If you only want to do things when a document set is created and you find that updates to the document set trigger the flow again then you could create a flow like this:

Action that only needs to be done on the creation of the document set

The above flow checks the content type id of the triggering document/folder or document set and then only runs my code when the modified date and the creation date are the same.

 

 

 

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as the Head of Power Platform at Vantage 365. You can contact me using contact@sharepains.com

13 thoughts on “Microsoft Flow – Get your flow to trigger on the creation of a Document Set”
  1. Thanks for this! Exactly what I’m doing at the moment. I wish we could ask it to only trigger on creation of this document set, instead of running every time and THEN checking if it’s a document set.. but.. we work with what we’ve got!

    Just wanted to comment, though, that it’s 0x012D520 not 0x0120520 as you have in your bolded text! Almost missed it. 🙂

  2. Hey,

    So I am fairly new to sharepoint and I was working on a project that requires the flow to be triggered only when a document set is created.

    I tried the above method and I was wondering how you got that string value for ctid.

    Thanks

    1. Hi Jay,

      When you go to the content type settings for the Document set you will find that the ctype parameter in the URL

      ….sharepoint.com/_layouts/15/ManageContentType.aspx?ctype=0x0120D520

      1. Hey Pieter,

        Thanks, that worked.

        I have a file (Word file) that gets added automatically whenever a new document set is created. I have a flow that should detect only when a new document set is created and post that message but it posts the message twice; One for the document set and one for the file. Am not sure what is wrong

        Thanks

      2. The trigger used is on creation and on modification of the document. I would probably put an additional condition in the flow checking if the modification data and the creation date are the same and only run the relevant code when these two dates are the same.

  3. Hey Pieter,

    Thanks a lot for the help, I tested out the flow and it works great

    Thanks again for the help

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading