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

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
Highlighted
Community Support
Community Support

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
Highlighted
Community Support
Community Support

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

Highlighted
Frequent Visitor

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

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

 

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?

Highlighted
Advocate II
Advocate II

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,903)