power-automaterecurring

How to make "When a file is created or modified (properties only)" trigger use the specified recurrence interval


I have a Power Automate flow that uses the When a file is created or modified (properties only) trigger to run when a file is created or modified in a Sharepoint folder. The flow then sends an email to the people who are responsible for signing the contracts that are placed in that folder. The flow works well except that I'd like the recipients to only receive one email per day, with all the contracts they have to sign that day, rather than receiving an email every time someone uploads a file to that folder.

I think I should be able to do this by selecting How often do you want to check for items? option and choosing an interval of "1" and a frequency of "Day". This is what the code view then looks like (with the parameters anonymised):

{
  "type": "OpenApiConnection",
  "inputs": {
    "parameters": {
      "dataset": "https://example.sharepoint.com/teams/Team-Example",
      "table": "d3f96774-ed5c-4303-bb3c-88dabcd14a6a",
      "folderPath": "/Shared Documents/Contracting/DocumentsToSign/Simon"
    },
    "host": {
      "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
      "connection": "shared_sharepointonline",
      "operationId": "GetOnUpdatedFileItems"
    }
  },
  "recurrence": {
    "frequency": "Day",
    "interval": 1,
    "timeZone": "New Zealand Standard Time",
    "startTime": "2024-10-14T12:00"
  },
  "splitOn": "@triggerOutputs()?['body/value']"
}

However, setting the "recurrence" seems to have no effect -- the trigger operates within a few seconds of a file being uploaded to the folder, regardless of what values are in the "recurrence" input.

I have a clue in that, a few days after I set the recurrence interval to 1 day, I have found that the recurrence interval resets to 1 second without me changing it, so I wonder if it is ever really being set to 1 day, despite that apparently being the case. Nobody else has access to the flow.

I'd be grateful for any suggestions as to how I could have the flow use the recurrence interval that I select.


Solution

  • A better Approach would be to Change the trigger to 'Schedule' once per day - say at 08:00 AM everyday to receive documents uploaded yesterday.

    Then you can retrieve the list using 'Get files (properties only) method and use an oData filter to fetch only yesterday's files to avoid overlapping with older ones.

    Here's a composite expression to only fetch yesterday's files. this will work as a sliding window every time the flow runs.

    Created ge @{addDays(startOfDay(utcNow()),-1)} and Created lt @{startOfDay(utcNow())}
    

    enter image description here

    here's what the trigger should look like:

    enter image description here