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

Prevent Duplicate Records from being submitted from a form onto Sharepoint

Hello, 

 

What I am trying to achieve is for the submit button to lookup the data contained in the Sharepoint and ensure that it isn't being duplicated and therefore preventing the user from submitting.

 

However, I am not sure how to go about this, the current code doesn't seem to be working. I'd also like there to be a notify through a notifcation type that what they are trying to submit as already been submitted.

 

The code is shown below 

If(
    IsEmpty(
        LookUp(
            'Enhancements FY2021',
            Title = DataViewTitle.Text
        ) 
    ),
    SubmitForm(SharepointForm), 
 UpdateContext({pop1: true}))

 

and here is the form, please note that the Line Item = Title in the code!!!

 Capture3.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Prevent Duplicate Records from being submitted from a form onto Sharepoint

@southafrican 

I believe you are missing an argument to the LookUp function.  The blue highlighted area of my code tells the LookUp formula what to return.  If the ID doesn't exist then IsEmpty will evaluate to True.

 

If(
    IsEmpty(
        LookUp(
            'Enhancements FY2021',
            Title = DataViewTitle.Text,
ID ) ), SubmitForm(SharepointForm), UpdateContext({pop1: true}))

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up.

 

View solution in original post

2 REPLIES 2
Dual Super User
Dual Super User

Re: Prevent Duplicate Records from being submitted from a form onto Sharepoint

Hi @southafrican 

 

In that case, can you try to update your expression as:
 
If(
    CountRows(
        Filter(
            'Enhancements FY2021',
            Title = DataViewTitle.Text
        )) =0,
    SubmitForm(SharepointForm),
    Notify("Record Already Exists!",NotificationType.Error);UpdateContext({pop1: true})
 
)
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Super User
Super User

Re: Prevent Duplicate Records from being submitted from a form onto Sharepoint

@southafrican 

I believe you are missing an argument to the LookUp function.  The blue highlighted area of my code tells the LookUp formula what to return.  If the ID doesn't exist then IsEmpty will evaluate to True.

 

If(
    IsEmpty(
        LookUp(
            'Enhancements FY2021',
            Title = DataViewTitle.Text,
ID ) ), SubmitForm(SharepointForm), UpdateContext({pop1: true}))

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up.

 

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

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