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 / Logged in user should ...
Power Apps
Answered

Logged in user should not select his/her own name in the person field as a Approver

(0) ShareShare
ReportReport
Posted on by 5

Hi Guys,

 

I am working on a project, when request has to fill in a form and has to choose an approver(person datatype in sharepoint List) in the powerApps form.

I want to add a condition where current logged in user should not be able to select his own name as a approver. He should get error.

Can someone please suggest the better approch.

 

Thank you!

Categories:
  • Verified answer
    Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    I would do this two ways.

    1) Have a label with an error message where visible is set to true if the approver is equal to the current user email (or current user email is 'in' the selected approvers if multiselect)

    2) Assuming there is a button to start the approval use the same logic to change the display mode to disabled unless the user picks a valid approver (not themselves)

     

    This won't keep them from picking themselves, but will keep them from using the pick without correcting the choice.

  • gargankush Profile Picture
    5 on at

    Thank you !

    I have used option 2 above.

    I have set the DisplayMode property of the button to the expression below:

    If(ApproverDataCard.SelectedItems.Email= User().Email,DisplayMode.Disabled,DisplayMode.Edit)

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    It would be a good idea to use #1 also.  Otherwise the user may not know why they can't submit.  Some kind of error message should be provided.

  • skyearning Profile Picture
    4 on at

    Hi Pstork1, can you help give some advice on how to write the code to tell if the current user email is IN the selected approvers? I tried my times but failed, maybe because I am not quite familiar with the data structure of the multiple persons field. Thank you!!

  • skyearning Profile Picture
    4 on at

    I tried to use the DataCardValue.Selected.Email, but it only reflects the last selected person's email, instead of the collection of the selected persons' emails. I also tried Concat but failed. 

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    If you allow multiple values then you need to use the 'in' operator instead of the '=' operator.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard