cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
vinimedina91
Level: Powered On

How to check if item already exists in SharePoint custom list

Hi guys,

 

I'm using SharePoint + PowerApps custom form (the one created direct when you use the custom form feature).

I have the following scenario in my list:

 

Request   Status

1234          Approved

5678          Approved

1234          Not Approved

1234          Not Approved

 

1. I'm creating an item for each request (I cannot update the request that already exists)

2. A request can be "Not approved" many times

3. A request can only be approved once

 

Once a request is approved, when the user tries to add it (let's use 1234 as example) it cannot be added as approved nor not approved. I'd like to validate this once the user submitt the item to be saved and show a message saying that this request is already approved.

 

Is that possible to achieve?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How to check if item already exists in SharePoint custom list

Hi @vinimedina91,

Do you want to check if the request the user wants to submit has been approved already within your SP list?

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:
3.JPGSet the OnSave property of the SharePointIntegration control to following:

If(
!IsBlank(LookUp('20190201_case1',Title = SharePointForm1.Updates.Title && Role.Value = "Approved")),
Notify("The Request you want to submit has been approved already in your SP list", NotificationType.Warning),
SubmitForm(SharePointForm1)
)

On your side, you should type:

If(
!IsBlank(LookUp('YourSPList',Request = SharePointForm1.Updates.Request && Status.Value = "Approved")),
Notify("The Request you want to submit has been approved already in your SP list", NotificationType.Warning),
SubmitForm(SharePointForm1)
)

Note: The Request and Status columns are both columns in your SP lost. I assume that the Status column is a Choice type column, the Request column is a Single line of text type column.

More details about the LookUp function, please check the following workaround:

LookUp function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: How to check if item already exists in SharePoint custom list

Hi @vinimedina91,

Do you want to check if the request the user wants to submit has been approved already within your SP list?

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:
3.JPGSet the OnSave property of the SharePointIntegration control to following:

If(
!IsBlank(LookUp('20190201_case1',Title = SharePointForm1.Updates.Title && Role.Value = "Approved")),
Notify("The Request you want to submit has been approved already in your SP list", NotificationType.Warning),
SubmitForm(SharePointForm1)
)

On your side, you should type:

If(
!IsBlank(LookUp('YourSPList',Request = SharePointForm1.Updates.Request && Status.Value = "Approved")),
Notify("The Request you want to submit has been approved already in your SP list", NotificationType.Warning),
SubmitForm(SharePointForm1)
)

Note: The Request and Status columns are both columns in your SP lost. I assume that the Status column is a Choice type column, the Request column is a Single line of text type column.

More details about the LookUp function, please check the following workaround:

LookUp function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

vinimedina91
Level: Powered On

Re: How to check if item already exists in SharePoint custom list

Wow! Thank you very much for your support and quick response. Smiley Happy

 

Got only one concern. When I added this formula to the "OnSave" there was one message saying that this might no work well on huge datasets. Is there a limit that I should worry about?

crsnt
Level: Powered On

Re: How to check if item already exists in SharePoint custom list

I tried this, it works however after submitting, if you try to add a duplicate item it still saves. The 2nd time will throw error.

 

I believe the SP list data is not updated after submission.

 

This also happens if I delete the item. I can't save the same one unless I click Save twice.

 

Any ideas? Smiley Happy

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Demo Extravaganza Championship Voting Open

Voting Ends: October 30, 2019!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 154 members 4,762 guests
Please welcome our newest community members: