cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jltitus
Frequent Visitor

Prevent duplicate list entries on SharePoint list displayed as combobox

Hi,

I have a SharePoint list with a PowerApps form (SubmitName). The form is to submit names for a program by entering the users email address. When submitting the form, I would like to check whether the persons' name already exists in the list "SPName" field. If it does, I would like an error message displayed.

 

List name is "Applicants List"

Field in list to check is "SP Name". This field is a People/Group field in the SharePoint list.

 

I've been searching  like crazy but I don't see a solution for my scenario. Here's what I've come up with so far.. but it doesn't work. Any assistance is welcome as I'm new to PowerApps.

 

If(
!IsBlank(LookUp('Applicants List',SPName=DataCardValue2.Selected.Value))
Notify("Record already exists", NotificationType.Error);
SubmitForm(SubmitName);
Notify("Request successfully submitted", NotificationType.Success);
NewForm(SubmitName)

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jltitus
Frequent Visitor

@WarrenBelz Thanks for the assist. I tried your suggestion above but it throws an error on the "Value". The SPName field is pulling from the users O365 account, would that make a difference?

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @Jltitus ,

You need to refer to the field type element and were also missing some commas and brackets

If(
   !IsBlank(
      LookUp(
         'Applicants List',
         SPName.DisplayName=DataCardValue2.Selected.Value
      )
   ),
   Notify(
      "Record already exists", 
      NotificationType.Error
   ),
   SubmitForm(SubmitName);
   Notify(
      "Request successfully submitted", 
      NotificationType.Success
   );
   NewForm(SubmitName)
)

Also if you are simply wanting to store a name in the Person field, ask yourself why are you simply not using a Text field - it will make a lot of things so much easier.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Jltitus
Frequent Visitor

@WarrenBelz Thanks for the assist. I tried your suggestion above but it throws an error on the "Value". The SPName field is pulling from the users O365 account, would that make a difference?

View solution in original post

@Jltitus ,

Yes - but I simply copied your code reference assuming it was valid - it will probably be something like DIsplayName - put your cursor after the second dot and the valid name should come up underneath.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,109)