cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jltitus
Helper III
Helper III

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
Helper III
Helper III

@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
Helper III
Helper III

@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?

@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
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (3,698)