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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using or together with...
Power Apps
Answered

Using or together with and within an If statement

(0) ShareShare
ReportReport
Posted on by

Hi I am trying to use the 'or' together with 'and' in an if statement but is it not returning the result I expected.

 

Basically I want to only enable a field called 'Policy Editor', when the UserEmail field is equal to the DocumentOwnerEmail field OR the LibrarianEmail field AND when the DocumentStatus field is equal to draft.

 

Using below formula only disables the Policy Editor field when both the DocumentOwnerEmail field and the LibrarianEmail field doesn't equal (contain)the UserEmail field.
If the UserEmail field  is equal to one of the fields and the Document Status doesn't equal Draft, it is still enabled.

It appears the If statement is ignoring the And /Document status part.
I need the Policy editor field to disable even when the UserEmail field equals either DocumentOwnerEmail field or LibrarianEmail field And when the Document Status field doesn't equal draft.
 
My If statement:

If(UserEmail.Text in DocumentOwnerEmail.Text Or UserEmail.Text in LibrarianEmail.Text And ThisItem.DocumentStatus.Value="Draft",DisplayMode.Edit,DisplayMode.Disabled)  

 

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Darren137227 

    With({poledit:UserEmail.Text in DocumentOwnerEmail.Text Or UserEmail.Text in LibrarianEmail.Text
              },

      If(poledit && ThisItem.DocumentStatus.Value="Draft", DisplayMode.Edit, Disabled
       )
    )

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Darren137227 

    With({poledit:UserEmail.Text in DocumentOwnerEmail.Text Or UserEmail.Text in LibrarianEmail.Text
              },

      If(poledit && ThisItem.DocumentStatus.Value="Draft", DisplayMode.Edit, Disabled
       )
    )

  • Verified answer
    zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    If((UserEmail.Text in DocumentOwnerEmail.Text || UserEmail.Text in LibrarianEmail.Text) && ThisItem.DocumentStatus.Value="Draft",DisplayMode.Edit,DisplayMode.Disabled)  

     

    try adding the or condition in bracket like above code

     

     

  • Darren137227 Profile Picture
    on at

    Thanks Zmansuri, worked a treat 

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard