🛠 Power Automate: Handling Cached Runs After Long Downtime

The Challenge

If you’ve ever turned off a Power Automate flow for maintenance, debugging, or updates, you may have noticed an unexpected problem when turning it back on:

Suddenly, the flow starts running for every single event that happened while it was off.

This happens because many connectors in Power Automate cache or store pending events during downtime — so that nothing is lost. While this is a great safeguard in some scenarios, in others it can cause:

  • Outdated notifications being sent after the fact

  • Duplicate processing of already-handled data

  • Overloaded systems with a flood of old runs

  • Confusion for users who receive actions long after they’re relevant


Why This Happens

When your flow trigger is event-based (e.g., new email, new Dataverse row, SharePoint item created), Power Automate stores those events until your flow is available again.

When the flow restarts, it processes all the cached events — effectively “catching up” from when it was last active.

While this ensures no data loss, it’s often the opposite of what you want in time-sensitive workflows.


The Goal

Prevent a flow from processing stale, cached events when it is turned back on.
We only want to process fresh, recent events — for example, items from the last 2 minutes.


The Solution: Trigger Condition Filtering

One simple and effective way to handle this is by using Trigger Conditions to compare the event timestamp to the current time, ensuring the event is recent.

Example trigger condition:








@greaterOrEquals( ticks(triggerBody()?['receivedDateTime']), ticks(addMinutes(utcNow(), -2)) )

How This Works

  • triggerBody()?['receivedDateTime'] → Gets the time the event (e.g., email) was received.

  • utcNow() → Current time in UTC.

  • addMinutes(utcNow(), -2) → Gets the time 2 minutes ago.

  • ticks() → Converts both times to numeric ticks for comparison.

  • greaterOrEquals() → Returns true only if the event is newer than 2 minutes ago.

Result: If the event happened earlier than the last 2 minutes, it’s ignored.


Step-by-Step Implementation

  1. Open your flow and go to the trigger (e.g., When a new email arrives, When a row is added).

  2. Click the ellipsis (⋮)Settings.

  3. Scroll down to Trigger Conditions.

  4. Paste the above expression.

  5. Save the flow.


Best Practices

  • Adjust the time window: Change -2 to a higher value (e.g., -5) if your process needs more tolerance for delays.

  • Test with sample data after re-enabling the flow to ensure only new events pass.

  • Document the logic so others understand why the trigger has a time filter.


Example Scenarios

  • Helpdesk Ticketing → Skip stale tickets created during downtime.

  • Approval Requests → Ignore approvals for requests already handled.

  • Notification Systems → Prevent sending alerts for outdated events.


Alternative Approaches

While the above method works well, other strategies include:

  1. Store the Last Processed Time in Dataverse or SharePoint and check against it.

  2. Manually Resume Processing with a controlled batch after downtime.

  3. Add a manual approval step before processing events after downtime.


Final Thoughts

Power Automate’s cached-event behavior is designed for data safety, but in real-time business processes, it can create unnecessary backlog and confusion.
By adding a simple trigger timestamp filter, you can ensure your flow processes only the events you actually want, keeping your workflow clean and relevant.






Comments

Popular posts from this blog

🚀 Automatically Moving Business Process Flow (BPF) Stages in Dynamics 365 Using JavaScript

AI-Powered Power Pages Development with Claude Code Plugin