Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Condition Comparing Dates is Always Resulting True

Like (0) ShareShare
ReportReport
Posted on 27 Jan 2021 18:17:28 by 44

Hi All,

I have a flow scheduled monthly to send an email if an item in a list has a due date within the next 34 days (ie next month). However, when I run the flow, it results true for every item, even those with due dates months from now. Any idea what I am missing?

AAallday_0-1611770306937.png

 

"isTrigger":false,

"operationName": "Condition", "operationDefinition":

{"type":"If","expression":
{"and":[
{"lessOrEquals":["@formatDateTime(outputs('Compose'),'yyyy-mm-dd')","@addDays(utcNow(),34,'yyyy-mm-dd')"]},
{"or":[{"equals":["@items('Apply_to_each')?['Status/Value']","Pending"]},{"equals":["@items('Apply_to_each')?['Status/Value']","Delayed"]}]}]},
"actions": {"Send_an_email_(V2)": {"type":"OpenApiConnection",

"inputs":{"host":{"connectionName":"shared_office365","operationId":"SendEmailV2","apiId":"/providers/Microsoft.PowerApps/apis/shared_office365"},

"parameters":{"emailMessage/To":"email@address","emailMessage/Subject":"test","emailMessage/Body":"<p>aasdfasdfasdf</p>"},"authentication":"@parameters('$authentication')"},

"runAfter":{}}},

"runAfter":{"Compose":["Succeeded"]}}}

  • AAallday Profile Picture
    44 on 27 Jan 2021 at 20:01:50
    Re: Condition Comparing Dates is Always Resulting True

    Looks like this works -- thank you! and thank you for the formatting catch!

     

  • Verified answer
    tom_riha Profile Picture
    10,085 Most Valuable Professional on 27 Jan 2021 at 18:38:11
    Re: Condition Comparing Dates is Always Resulting True

    Hello @AAallday ,

    can you add 2 Compose actions just before the condition, put @formatDateTime(outputs('Compose'),'yyyy-mm-dd') into one of them and @addDays(utcNow(),34,'yyyy-mm-dd') into the other? You'll then see in the run history what dates enter the condition and if it should return true/false.

    Also, the date format you use ('yyyy-mm-dd') is not right. Lowercase 'mm' = minutes. For months it must be upper case 'MM'. The format should be 'yyyy-MM-dd'.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,765 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started