Trigger When a file is created or modified in SharePoint

Power Automate and Azure Logic Apps are great to use as automation tools for processes that include SharePoint data. A trigger that I often use is when a file is created or modified in SharePoint. Unfortunately, they also seem to suffer from some limitations on large lists/libraries which can be quite hard to troubleshoot.
In this blog post, I describe the issue that I have recently experienced and how it can be quickly resolved.

Problem with flow – file created or modified

I encountered an issue on a client Office 365 tenant where flow triggers from a specific list were frequently breaking. The trigger used was When a file is created or modified (properties only) and seemed to only fail on that particular list. The list had around 450k documents at the time and multiple custom fields.
A support call was going on for about 3 weeks and during that period, the only workaround to keep functionality was to create a copy of the broken flow by using the “Save as” option. This would keep us running for a few days until the copy was also broken and we would create a new temporary copy – far from ideal, but kept things running.

Azure Logic Apps

Trying to find a solution to the issue or a reliable long-term alternative, I went to re-create the flow as an Azure Logic App. Configured the logic app to run every minute and tried to test it by uploading some documents to the library.
Nothing happened.
I started troubleshooting and 1 hour later the instances were executed without any change being made. As I kept uploading documents for testing, the logic app kept running on significantly delayed schedules.

Solution

The solution turned out to be quite simple.
I tried to test different triggers and created a new logic app using the When a file is created (properties only) trigger. When testing it the first time, it failed, but gave me the solution to the problem. The error message stated that the Created column was being indexed on the list and that the logic app would start working shortly. I went to the Indexed Columns and could see a label next to the Created column to show that it was being indexed.

In my case, the Modified field was already (automatically) indexed on the list, so after the index of the Created field was completed, both logic apps started working as expected.

In summary, if you have large SharePoint lists and need to use automation triggers for when items are created or modified, double-check that the relevant list columns are indexed!
The link to the Indexed Columns page for each list can be accessed under list Settings, at the bottom of the Columns section (just before the Views section).

2 Replies to “Trigger When a file is created or modified in SharePoint”

  1. Hi, I need help creating a workflow that will update a SharePoint list item after a file is modified. I created the flow but it keep failing.

    1. Hi, sorry for the late reply, had an issue with comments…
      Are you still having issues? If so, can you provide more details?

Leave a Reply

Your email address will not be published. Required fields are marked *