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 / Sharepoint Form in Pow...
Power Apps
Answered

Sharepoint Form in Powerapps - Validation to prevent duplicate email/user in owner & member fields

(0) ShareShare
ReportReport
Posted on by 181

Hi All - I have a MS team request form that works pretty well overall but I need to  build in some validation to prevent a user from submitting themselves as both an Owner and a Member. I believe the API fails when this is the case because MS Groups/Teams doesn't allow you to be both a member and owner.

 

team request.png

 

 

I've attached a picture of my form. I would like to prevent any user selection in the Owner field to exist in the Members field.

 

I would imagine this is a if statement that will need to exist on the Submit Request button and shows the error message if the same user exists in both fields, I just need some help crafting such a statement since multiple users can be in the owner or member fields.

 

TIA!

Categories:
I have the same question (0)
  • Liam_Chapman Profile Picture
    187 on at

    Hi @EricC ,

     

    Just wondering if it would be easier to just change the display mode of the 'Submit Request' button. 

     

    So if the values of each drop down match, make the button disabled.  

  • EricC Profile Picture
    181 on at

    Possibly, but I guess I'm wondering how I would go about that because it is a person selector field from o365. So it could be like this

     

    owner(s) - user1@office.com user2@office.com

    Member(s) - user2@office.com

     

    I'm struggling with the code for finding the match to be able to show an error message.

  • Verified answer
    rsaikrishna Profile Picture
    3,703 on at

    @EricC 

     

    On the Submit button, give a try with following formula:

     

    Clear(colCommonUsers);
    ForAll(
     drpMembers.SelectedItems,
     If(
     DisplayName in drpOwners.SelectedItems.DisplayName,
     Collect(
     colCommonUsers,
     DisplayName
     )
     )
    );
    If(
     !IsEmpty(colCommonUsers),
     Set(
     varCommonUserDisplayFlag,
     true
     );
     Set(
     varCommonUser,
     Concat(
     colCommonUsers,Value,
     ";"
     )
     ),
     SubmitForm(<SharePointListDataSource>)
    )

     

    Please a label on the form and name its properties as below:

    Text: "The user " & varCommonUser & " exists in both Owners and Members fields. You can add a user either in Owners or Members field."

    Visible: varCommonUserDisplayFlag

     

    On visibility of the screen, set following two variables as below:

    Set(varCommonUserDisplayFlag, false);
    Set(varCommonUser, blank())

     

    Regards

    Krishna Rachakonda

    If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

     

  • EricC Profile Picture
    181 on at

    Thank you! This is exactly what I needed, I setup a dynamic popup with a button based on what you provided so they can close the popup and correct the error and then resubmit.

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard