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:
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.
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:
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.
do you know if it possible to get the properties from the document set?
The document set is just a file/item to that should just work
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. 🙂
Hi Rhia,
I’m glad that my post helped you!
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
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
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
Can you check if your flow is triggered twice by checking the number of flow runs?
Yes, unfortunately the flow gets triggered twice
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.
So I added a condition to check if the file created has the same date as file modified but it still posts two messages.
This is the imgur link of the flow https://i.imgur.com/HIM5rbq.png
Hi Jay, I’ve just updated the post with a full overview of the flow that also checks if the document set is created or if it is modified.
Hey Pieter,
Thanks a lot for the help, I tested out the flow and it works great
Thanks again for the help