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

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

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

@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
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,307)