However, what if you want to run the same Flow for triggers generated from multiple lists? One option is to have one flow per list that will call the common flow. Doable, but requires a lot of extra work and maintenance if the logic changes in any way. What would simplify this process is an event that is easy to set up and configure on any list and library.
Using an Email-based trigger
In this example, I'm leveraging the Alerts mechanism that can be set up on each list or library to trigger a common flow. The logic behind this approach is that when SharePoint sends an alert email on an item or document, it includes a link to the item and item ID, which are the key pieces of information you need.Preconditions
To do so requires several things:- Alert emails should be sent immediately
- Ideally, there should be a service account for all the flows
- The Alert Title needs to be consistent across all the lists for the flow
Flow breakdown
The Flow, depicted below, is broken down into 8 steps.The first step is the trigger, which acts when an email arrives for the user account that is running the Flow. Alert emails are generated from the no-reply@sharepointonline.com system account, so you can configure the trigger to only act on messages coming from that address. Also, make sure to configure the Subject Filter to match the Alert Title you set on your list.
Steps 2 through 6 are mostly a text parsing exercise to extract the site URL, list URL, and item ID. They are all embedded in the email body. Step 3 helps clean up all the HTML tags, thus making it a bit easier to parse out the elements.
Once you have your item ID and link, you're all set to get the item (step 7) and do with it as you wish. Optionally in step 8, you can delete the alert email if you have no other use for it.
Can you add any details on what strategy you used to extract your data?
ReplyDeleteI was using the standard alert email and was parsing it out.
ReplyDeleteHaniel, you are a genius! This a really great solution. I was able to delete 30 or so copies of my flow and now I only I have run one for the whole site! Absolutely brilliant. Thank you so much for this!
ReplyDeleteGlad it helped you with your clean-up.
Delete