Power Automate Trigger Condition Formulas Cheat Sheet: Ready-to-Use Examples for Business Hours & Email Filtering

Here’s a collection of Power Automate trigger condition formulas that I personally use frequently or get asked about often.

スポンサーリンク

Trigger Conditions

Power Automate trigger conditions are a feature that allows you to set conditions for when a trigger should execute.

In the new designer, you can access this from the [Settings] tab:
In the classic designer, you can specify this from the [Settings] menu:
By the way, this formula uses the same syntax as when editing the “Filter array” action in “advanced mode”:
The major benefit of using trigger conditions is that the flow execution itself doesn’t occur, which helps reduce execution counts and resource consumption.
Limits of automated, scheduled, and instant flows - Power Automate
Learn about the limits that apply to automated, scheduled, and instant flows in Microsoft Power Automate.

In this article, I’ll compile the trigger condition processes that I personally use most frequently.

Date and Time

Date and time condition formulas are commonly used with “Scheduled” triggers.

Day of the Week

Let’s start with days of the week. These are frequently used for flows that should run only on weekdays or only on weekends (like batch processes).
* Public holidays are difficult to handle with trigger conditions (while not impossible if you specify fixed values, it’s quite cumbersome…), so holidays are often filtered out using conditional logic within the flow itself.

// Only run from Monday to Friday
@and(
  greaterOrEquals(dayOfWeek(addHours(utcNow(), 9)), 1),
  lessOrEquals(dayOfWeek(addHours(utcNow(), 9)), 5)
)

// Only run on Saturday and Sunday
@or(
  equals(dayOfWeek(addHours(utcNow(), 9)), 0),
  equals(dayOfWeek(addHours(utcNow(), 9)), 6)
)

// Only run on a specific day of the week (in this example, Wednesday only)
@equals(dayOfWeek(addHours(utcNow(), 9)), 3)

// Result of dayOfWeek function: Sunday=0, Monday=1, Tuesday=2, Wednesday=3, Thursday=4, Friday=5, Saturday=6

Time

Next is time. These are commonly used for flows that should run during business hours or outside of business hours.

// Within business hours (in this example, business hours are from 09:00 to 18:00)
@and(
  greaterOrEquals(addHours(utcNow(), 9, 'HH:mm'), '09:00'), // (Time must be in 24-hour format with leading zeros)
  lessOrEquals(addHours(utcNow(), 9, 'HH:mm'), '18:00')
)

// Outside of business hours
@or(
  less(addHours(utcNow(), 9, 'HH:mm'), '08:00'),
  greater(addHours(utcNow(), 9, 'HH:mm'), '18:00')
)

Outlook

Next is Outlook. These are used for flows that should run only when the subject contains specific text, or when emails are received from specific senders.

// Only trigger for emails from a specific sender (in this example, sample@example.com)
@equals(triggerOutputs()?['body/from'], 'sample@example.com')

// If there are multiple specific email addresses
@or(
  equals(triggerOutputs()?['body/from'], 'sample1@example.com'),
  equals(triggerOutputs()?['body/from'], 'sample2@example.com')
)

// Only trigger for emails from a specific domain
@endsWith(toLower(triggerOutputs()?['body/from']), '@example.com')

// If there are multiple specific domains
@or(
  endsWith(toLower(triggerOutputs()?['body/from']), '@example.com'),
  endsWith(toLower(triggerOutputs()?['body/from']), '@example.org')
)

// Only trigger if the subject contains a specific keyword (in this example, "invoice")
@contains(triggerOutputs()?['body/subject'], 'invoice')

SharePoint, OneDrive

For SharePoint and OneDrive, these are primarily used for flows that trigger only when files with specific extensions or files containing specific text in their names are uploaded to document libraries.

// Trigger only for specific file extensions (e.g., .pdf files)
@endsWith(toLower(triggerOutputs()?['body/{FilenameWithExtension}']), '.pdf')

// Trigger only when filename contains specific text (e.g., "invoice")
@contains(triggerOutputs()?['body/{FilenameWithExtension}'], 'invoice')

The following sections are for testing each formula. Please proceed if you’re interested.

Testing

Date and Time

For testing date and time functionality, I set up a scheduled trigger that runs every minute.

Day of the Week

First, I configured the trigger condition to run only “Monday through Friday”:
When tested on 5/29 (Thursday), the flow triggers successfully.
In contrast, when configured to run only on weekends:
Since it’s Thursday, the flow doesn’t trigger.

Time

Next, when configured to run only between “08:00 ~ 22:05”:
The flow doesn’t trigger after 22:06.
Conversely, when configured to trigger after 22:10:
The flow starts triggering from 22:11 onwards.
* 22:11 was skipped due to the timing of saving the flow.

Outlook

The trigger used is “When a new email arrives”.
First, when configured to trigger only for a specific email address:
Even when two emails arrive simultaneously:
The flow triggers only once (only for the specified email address).
Next, when configured to trigger only for a specific domain:
Even when emails from two different domains arrive (one being Gmail):
The flow triggers only once (for the specified domain only).

SharePoint

For the SharePoint experiment, I used the “When a file is created” trigger.
First, when configured to trigger only for PDF files:
Even when uploading two files simultaneously:
The flow triggers only once (for the PDF file).
Next, when configured to trigger only when the filename contains “invoice”:
Even when uploading two files:
Only the invoice file triggers the flow.

Related Articles

スポンサーリンク

Support This Website

Thank you for visiting! It's because of readers like you that I continue to write and maintain this blog.

If you found this content helpful, consider buying me a coffee to support my work.

Ippu

Power Platform Engineer. Recently, I've also been working with generative AI, Azure, C#, and Python coding. I spent about 5 years developing in C# and C++, then worked in various service industries including hair & makeup, cafes, and retail.
I returned to IT in 2020 and now focus on designing and developing with Power Platform.
My cat's name is "Kotsubu," which means "small grain size" in Japanese.

Ippuをフォローする
Power Automate
スポンサーリンク
スポンサーリンク
スポンサーリンク
The Work Diaries

コメント

Copied title and URL