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

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
Highlighted
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
Highlighted
Dual Super User III
Dual Super User III

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!
Highlighted
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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response 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 (4,513)