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 triggerIn 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.
PreconditionsTo 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 breakdownThe 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 firstname.lastname@example.org 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.