cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Razor
Level: Powered On

One Flow to Rule them All?

I have Flows monitoring subsite document libraries. They all do the same thing. They send an alert whenever someone outside our domain add/changes a document in one of the document libraries.
 
I recently received a request from one of the stakeholders of the project to change part of the Flow. Before I go and change numerous flows, I want to make sure I'm handleing this the right way.
 
It is my understanding that I need to have a Flow for each site because of each library's unique file path. (Remember these are subsites.) From a visual point of view I currently have this;
 Screen Shot 2019-02-07 at 5.15.21 PM.png
Is it possible to have one Flow watch over all subsite document libraries like this?
Screen Shot 2019-02-07 at 5.28.34 PM.png
13 REPLIES 13
Super User
Super User

Re: One Flow to Rule them All?

Hi @Razor,

 

Thanks for the questions and good diagrams to explain your requirment.

 

What I understood is you want to generalize a flow from a single trigger.

 

You could try the following

sharepointlists.png

 

So your trigger going to be Recurrence.

Define your site address.

 

In the apply each you could add a check condition to check your library name matching "Displayname". I haven't added this if condition in my example. Then check Get Items to get each libraries.

 

So the next challenge is how the user updated or created a document. So for this you need a custom column to add in your SharePoint document libraries called 'lastcheckedbyflow' with a datetime. Check this by modifed date from the meta data of "Get items". Then do your rest of the logic to send alert. Once the alert is send then you update the list column 'lastcheckedbyflow' by using the same value as modified date. So when next time a user updates the same document the 'lastcheckedbyflow' value is different so that you can send alerts.

 

If it is useful then please accept this as solution.

 

Let me know how it goes.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Razor
Level: Powered On

Re: One Flow to Rule them All?

I had some time to experiment with this today. I configured the Flow to send me an email with the results. When I went to run it on the parent site I only get the Document library in the parent site. In otherwords it does not appear to acknowledging that the subsites exist.

 

I then changed the URL in the Get all lists and libraries step to a site where I have two document libraries. When I ran it again I received two emails; one for the Documents library, and a second one with the library I created. I'm extremely confident in saying the Get all lists and libraries only works for the site URL you provide and nothing underneath it.

 

Just to be clear because I am rather new at this, this is what my flow looks like so far. Am I doing something wrong or different from what you suggested?

Screen Shot 2019-02-12 at 3.15.03 PM.png

Super User
Super User

Re: One Flow to Rule them All?

Hi @Razor,

 

Thanks for your reply. Sorry I didn't realised that you have different sites.

 

So in this case you need to declare a compose function expression createArray('https://site1', 'https://site2','https://site3'). Next put this in a loop and dynamically read the site names. Again next action is another loop to get all document libraries under each sites and so on.

 

If you need any help please let me know.

 

If you found this answer is helpful please mark it as accepted solution.

 

Thanks

 


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Super User
Super User

Re: One Flow to Rule them All?

Forgot to add the image

sites.png



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Razor
Level: Powered On

Re: One Flow to Rule them All?

No problem, I appreaciate the help. I try my best to explain what I have and what I am trying to do. I always manage to leave some important detail out. Smiley Wink

 

So in my compose createArray, am I putting in the address of each of the subsites? I didn't get a chance to look at this yet, but I'm hoping there isn't a limit as to how long that string{statement} can be for createArray...

Super User
Super User

Re: One Flow to Rule them All?

Hi @Razor,

 

Thanks for your reply. Not sure about the length. I tried upto 11 sites and it did worked.

 

comp1.png

 

 

 

 

 

 

 

 

 

Let me know how it goes. Good luck.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Razor
Level: Powered On

Re: One Flow to Rule them All?

This is more of a bump than anything else. I wanted to let you know I'm still working on this.

 

I was sidetracked the last few days by a project with a higher priority. Had some time today to play with things and making progress. Thank you for your help so far. 

Michelangelo
Level: Powered On

Re: One Flow to Rule them All?

To piggy-back on ABM's comment... Why not add multiple actions "Get all lists and libraries" and add an action for every site.

So it would be like this... if referencing ABM's image...

--Recurrence

--Get all lists and libraries (Parent)

--Get all lists and libraries (subsite 1)
--Get all lists and libraries (subsite 2)

--Get all lists and libraries (subsite 3)

--etc. for each subsite. 

 

Does this ideology expand upon your thought process in a way that is helpful?

Super User
Super User

Re: One Flow to Rule them All?

Hi @Razor ,

 

Thanks for the update. If you need anymore help let me know.

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Razor
Level: Powered On

Re: One Flow to Rule them All?

Okay, so this is where I am with things. I am able to get a list of libraries for a site. I now need to be able to iterate my way through each library to see what the Modified date is and compare that to the LastCheckedByFlow column I created in my library.

 

I'm thinking my logic should be this;

For each file in library

     If LastCheckedByFlow is null then
         LastCheckedByFlow = (Now)
     End if
     
     If Modified > LastCheckedByFlow
           If domain <> our domain
               Send an email
           End if
     End if

     Set LastCheckedByFlow to (Now)

I figure since on my very first pass, LastCheckedByFlow will be a null so I better set it ASAP so it doesn't  error out somewhere.

 

I started working on the Flow but I'm stuck. Admittedly I don't know if I'm on the right track, but I'm trying to address the LastCheckedByFlow property. How do I do that? And how do I do that? With that bit of knowledge (and confirmation I'm on the right path) I'll keep on working. 🙂

 

Screen Shot 2019-02-21 at 3.12.29 PM.pngScreen Shot 2019-02-21 at 3.12.58 PM.pngScreen Shot 2019-02-21 at 3.13.34 PM.png

Super User
Super User

Re: One Flow to Rule them All?

Hi @Razor ,

 

Nice progess and good work :-). Also good screenshot to explain your logic.

 

Did you added the column called 'Last Checked By Flow' (DateTime) in your library?

 

If not then go to SharePoint library. Click the settings > library settings 

OR Click the add new column from your SharePoint library

 

Create column : Last Checked By Flow : Type: Date and Time

 

See below SharePoint library columns.

spcolumn.png

 

 

Once you created the column then open your flow 'Get File properties'

You should be able to retrieve the column 'Last Checked By Flow'.

 

Please see below.

 

flowcondition.png

 

 

 

 

 

 

 

Hope it make sense. Any help let me know.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Razor
Level: Powered On

Re: One Flow to Rule them All?

Brief update, due to time constraints I had to give in and create several smaller Flows, one for each subsite. I was able to use some of what I learned here to simplify my template so that I don't have to make as many changes for each site. I know you were all hoping for my success and to get this closed, so was I, but it isn't going to happen right now. Thanks for all the help.

Super User
Super User

Re: One Flow to Rule them All?

Hi @Razor ,

 

Thanks for the update. Again if in future if you needed any help please let me know.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,962)