cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Aditya1728
Helper II
Helper II

Sharepoint list - avoid duplicate items

Hi Experts,

 

I have a powerapp which is a referral form (SharePoint list).

I do not want a new referral created for a candidate m if he/she is already referred.

I can do it by enforcing unique values.

 

The problem with that is , if I apply that, in my view status screen, everyone will be able to see all profiles which are referred.

I want people to see only the names they have referred but at the same same enforce unique values based on Candidate Name.

 

Is it possible?

 

Also can I apply enforce unique values based on combination of of multiple column values of a SharePoint list?

 

Appreciate your help.

1 ACCEPTED SOLUTION

Accepted Solutions
StalinPonnusamy
Super User
Super User

Hi @Aditya1728 

 

Set the App OnStart property to

 

Set(UserInfo, User())

 

To filter the Gallery only the user Referred

 

Filter(SPList, ReferredPersonColumn.Email = UserInfo.Email)

 

 

I assume you have a column that stores who referred. 

 

#2 - Uniqueness

We can enforce uniqueness by validating the existing entry before Save the Form like

 

 

If(IsBlank(LookUp(SPList, Firstname=FirstNameDataCardValue.Text && Lastname=LastNameDataCardValue.Text)),
   SubmitForm(EditForm1),
   Notify("Duplicate entries found",NotificationType.Error)
)

 

 
Thanks,
Stalin - Learn To Illuminate

View solution in original post

8 REPLIES 8
StalinPonnusamy
Super User
Super User

Hi @Aditya1728 

 

Set the App OnStart property to

 

Set(UserInfo, User())

 

To filter the Gallery only the user Referred

 

Filter(SPList, ReferredPersonColumn.Email = UserInfo.Email)

 

 

I assume you have a column that stores who referred. 

 

#2 - Uniqueness

We can enforce uniqueness by validating the existing entry before Save the Form like

 

 

If(IsBlank(LookUp(SPList, Firstname=FirstNameDataCardValue.Text && Lastname=LastNameDataCardValue.Text)),
   SubmitForm(EditForm1),
   Notify("Duplicate entries found",NotificationType.Error)
)

 

 
Thanks,
Stalin - Learn To Illuminate

Aditya1728
Helper II
Helper II

Thanks @StalinPonnusamy , it worked like a charm.

 

Just one query, what if the two column combination I want to check say Name (Text) and position (dropdown), is it possible?

Currently it says that can only apply it for the same column type.

 

What I want to do is the candidate plus the position he/she is referred too, that combination should not be submitted again.

StalinPonnusamy
Super User
Super User

Hi @Aditya1728 

 

Definitely, this is possible to add multiple conditions like below

If(IsBlank(LookUp(SPList, Firstname=FirstNameDataCardValue.Text && Lastname=LastNameDataCardValue.Text) && Position.Value = PositionDropdown.Selected.Value),
   SubmitForm(EditForm1),
   Notify("Duplicate entries found",NotificationType.Error)
)

 

I assumed a Position in Sharepoint is a Choice column.

 


Thanks,
Stalin - Learn To Illuminate

@StalinPonnusamy 

It still gives me the same error:

Aditya1728_0-1636133852536.png

 

I have two columns:

1. Candidate Name (normal text column)

2. Location (This is a lookup column which takes its value from another list named as location)

 

While applying the formula you have provided, I do not find the Location column in the intellisense at all.

It only gives me the source list name (via which vlookup is running).

@StalinPonnusamy - would this work if the SharePoint list has restrictions that only allow users to see entries that they have created? Based on @Aditya1728 's post, it sounds like that might be the case.

 

My understanding is that this method would ensure that User A would be unable to refer the same person twice, but would not stop User A from adding a user that User B has added.

StalinPonnusamy
Super User
Super User

Hi @Aditya1728 

 

 

!IsBlank(
    LookUp(
        'External User',
        FullName = TextInput1.Text && LocationEU.Value = LocationDropdown.Selected.Title
    )
)

 

 

In this example, LocationEU is a LookUp to Location SP List. The below label checks whether name and location exist and returns true or false. The same concept we are using for your scenario.

 

StalinPonnusamy_0-1636136816814.png

 


Thanks,
Stalin - Learn To Illuminate

StalinPonnusamy
Super User
Super User

Hi @Aditya1728 

 

Please post the code that you tried, if still is an issue.

 

Aditya1728
Helper II
Helper II

@StalinPonnusamy 

Tried the code with If (Isblank instead of !Blank and it worked.

Thank you so much.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (4,079)