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 / Check for Duplicates i...
Power Apps
Answered

Check for Duplicates in SharePoint list before Form Submit

(0) ShareShare
ReportReport
Posted on by 1,362

Hello,
I have a form where a user can enter an Out of Office request and the person is not allowed to enter the request for the same role twice unless the first request was completed or in this case "Processed"
This is for a new entry, not edit.
The lookup field being used is "Role Name" that looks up the role from the "Roles" List.
The person enters the to and from dates they will be out of office, enters a "Role Owner" and a "Delegate" to handle approvals while out of office.
What I was hoping I can do, and I looked everywhere online and found various of solutions, but none really related towards what I was looking for.  
Is it possible to look at a list before submitting the form and compare it with a DataCard Entry and check the "Approval Status" is equal to "Processed". If the Role Name = the DataCard Role Name and the Approval Status equals "Processed" then submit the form else show a warning and hide the submit button.

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

    Hello   @golfnutt82 

    Please refer to my latest post here regarding the same 🙂

     

    Pasting answer for any people who stumble upon the same issue 

    If(!IsEmpty(Filter('Role Owner Out of Office', Title = txtRoleName && 'Approval Status'.Value <> "Processed")), Notify("The Out of Office Request was already entered and in process.",NotificationType.Warning);RequestHide(),SubmitForm('New OoO Form'))

     

    Cheers !

  • golfnutt82 Profile Picture
    1,362 on at

    I get the notification whether the title field in the list is blank, and the Approval Status is not equal to Processed.
    The logic is under the test button.

    golfnutt82_1-1652730117733.png

    So when looking at the data I have two Governor entries for the same Role and both are set to "Processed" so I should be able to add a new Out of Office entry for that role but I get the error. Below is the list.

    Any ideas what I could be missing.

    golfnutt82_0-1652732838387.png

     

  • Anonymous_Hippo Profile Picture
    1,247 Super User 2024 Season 1 on at

    Hello @golfnutt82 ,

     

    Can you try this. Here i am replacing Not equal with the actual set of value that i can see from the list i.e "Pending" And "In Progress" if you have more options like Blank add it with and or statement ||.

     

    Please note that <> is a non delegable operator and seems to be the main culprit here. I also remove the "!" since it is not relavent

    If(IsEmpty(Filter('Role Owner Out of Office', Title = txtRoleName && ('Approval Status'.Value = "Pending" || 'Approval Status'.Value = "In Progress"))), Notify("The Out of Office Request was already entered and in process.", NotificationType.Warning)); RequestHide(), SubmitForm('New OoO Form'))

     

    Please let me know if this works 

  • golfnutt82 Profile Picture
    1,362 on at

    Hi,
    Thanks again for your assistance.
    When I saw this, I thought it made sense and was excited to give it a shot. However, when I put the logic in I received an error.

    golfnutt82_1-1652789838787.png

    Frustrating. 

     

  • Anonymous_Hippo Profile Picture
    1,247 Super User 2024 Season 1 on at

    Hello @golfnutt82  ! 

     

    Can you please explain what "txtRoleName" is... is it a variable or a name of dropdown. Is Role name a drop down field or a combo box field ?

     

    Thanks

  • golfnutt82 Profile Picture
    1,362 on at

    I have a Power Automate workflow that uses Odata filter query in a Get Items action and it uses txtRoleName.
    It is the value of the lookup/combo box that holds the Role Name.
    The Role Name is a look up to the "Roles" list as there are many, which is why I have the search function in the Items property.

    golfnutt82_0-1652796897130.png

    The Title field WAS a field that held the requestor name and the Item ID but based on the logic that was out there that I had tried to apply it was checking to see if the Title field was equal to the txtRoleName field.
    I am open for suggestions to pull this off.

  • Anonymous_Hippo Profile Picture
    1,247 Super User 2024 Season 1 on at

    can you try this @golfnutt82  :-

    We are basically looking at what the user entered in the combobox is same as the sharepoint column. Hopefully this one works ... fingers crossed 🙂

     

    If(IsEmpty(Filter('Role Owner Out of Office', txtRoleName=ComboBox1.Selected.Value && ('Approval Status'.Value = "Pending" || 'Approval Status'.Value = "In Progress"))), Notify("The Out of Office Request was already entered and in process.", NotificationType.Warning)); RequestHide(), SubmitForm('New OoO Form'))
    

     

     

  • golfnutt82 Profile Picture
    1,362 on at

    ComboBox1 is actually the "Role Type Filter" that filters the role by one of four choices. 

    The lookup or combo Box is designated as dataCardValue1

    golfnutt82_0-1652804857185.png

    golfnutt82_2-1652805171097.png

    Because the logic is comparing the wrong field it allowed me to put in multiples, but I like the direction.

    golfnutt82_3-1652805353414.png
    If I could compare the value of DataCardValue1 to the txtRoleName then I believe it would work.
    I get an error if I try to use DataCardValue1

    golfnutt82_5-1652805660314.png

     

  • Anonymous_Hippo Profile Picture
    1,247 Super User 2024 Season 1 on at

    I think this looks promising 🙂 @golfnutt82  We will get this to work , we are very close !!!

    Can you hover over the equal to sign and see what the error is most probably we are not comparing similar data type maybe one is table and the other is a text.

     

    can you try to do the following add a "." next to txtRoleName and add the suggested popup. That should get to work else please let me know what error you are seeing also can you please mention what kind of field txtRoleName is in the sahrepoint column. Is it a choice or a single text field

     

    Thanks

  • Verified answer
    golfnutt82 Profile Picture
    1,362 on at

    Got it!!!
    I had to use the "!" character and then with your help I was able to come up with this and it works.

    golfnutt82_0-1652808635802.png
    I know you said that the "Not Equals" is not delegable, I knew that which is fine because I don't plan on keeping over 2000 records in the list anyway. 
    Mr. Hippo you are a life saver.
    Got me thinking differently.

     

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard