web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / AND OR in same expression
Power Automate
Answered

AND OR in same expression

(0) ShareShare
ReportReport
Posted on by 31

I've seen a couple of posts on this subject but I just can't get it to work.  Basically I want to add an if statement along the lines of:

 

IF Created Date = Modifed Date OR (Document Type is not blank AND Date is not blank AND reference is not blank)

 

In Flow I've added the following expression in the condition step:

 

@or(
equals(triggerBody()?['Created'], triggerBody()?['Modified']),
and(
not(empty(triggerBody()?['Document_x0020_Type'])),
not(empty(triggerBody()?['Date_x0020_of_x0020_Work'])),
not(empty(triggerBody()?['Property_x0020_Reference']))
)
)

 

However, this doesn't work and items that should pass this test aren't.  Am I using the correct syntax?

 

I'd be grateful for any assistance anyone can give.

 

Thanks in advance.

Categories:
I have the same question (0)
  • Verified answer
    v-bacao-msft Profile Picture
    Microsoft Employee on at

    Hi @gjayne84,

     

    I tested your formula and found it to be correct. I was wondering if you configured the wrong Trigger. If you are using When an item is created, then this condition will always be true.

    I did a test on my side, using When an item is created or modified as the trigger, and then using the your formula. It work fine.

    The configuration of the SharePoint list's Column, only Date of Work is the Date and time type, the others are Single line of text:

    46.PNG

    Can you share your Flow configuration?

    I have other formulas you can use here, and Trigger still uses When an item is created or modified.

    @or(equals(triggerBody()?['Created'], triggerBody()?['Modified']),and(not(equals(empty(triggerBody()?['Property_x0020_Reference']), true)),not(equals(empty(triggerBody()?['Document_x0020_Type']), true)),not(equals(empty(triggerBody()?['Date_x0020_of_x0020_Work']), true))))

    Please try this again.

    For more information on the usage of Expression, please refer to this link:

    use-expressions-in-conditions

     

    Best Regards,

    Barry

  • gjayne84 Profile Picture
    31 on at

    Thanks @v-bacao-msft I've checked the flow again and I've found the issue.  The first test of Creted = Modified was failing my end because even though the dates were the same, the time was different by a few seconds.  I added formatDateTime() around each of the date fields to remove the time and this now works.

     

    My next step is to try and resolve the issue of the flow running each time an individual field is modified on an item in the library.  For example, if I edit three fields on a document using modern edit form the flow runs three times.  The only way around this I've found so far is to go to Properties > Edit All for an individual document and then I can change multiple fields before clicking Save.

     

    Thanks for your help with the if statement though, it was useful to get another pair of eyes look at it to make sure the syntax was correct.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 224 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 181 Super User 2026 Season 1

#3
Kalathiya Profile Picture

Kalathiya 97 Super User 2026 Season 1

Last 30 days Overall leaderboard