Skip to main content

Notifications

Community site session details

Community site session details

Session Id : lgrorsC90DChXlPfBVYvNg
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,093 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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

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

Leaderboard > Power Automate - Building Flows

#1
David_MA Profile Picture

David_MA 247 Super User 2025 Season 1

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 228 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 210

Overall leaderboard
Loading started