web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Form Submitting Insert...
Power Apps
Answered

Form Submitting Inserting New Item into SP List - How to Detect a 400 Error (Unique SP column)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a canvas power app that uses a simple form. The form is always in a formMode.new and it inserts a new item into a SharePoint list. The SharePoint list has a column that requires the data to be unique to the list so there can be no duplicates items for that column.  When I submit the form with a duplicate value for that column, I get a 400 error. What is the best method to detect a 400 error when submitting my form? I have found some examples for using Patch but not for form submission.

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    You might consider the approach of not letting a user submit if there is a duplicate, rather than trying to catch the error and handle it (as error handling is a bit tricky in PowerApps).

     

    Set your DisplayMode of your submit button to something similar to this:

    If(
     !IsBlank(
     LookUp(YourDataSource, yourUniqueField = theControlWhereSomeoneWouldEnterTheValue.Text, ID)
     ), 
     Disabled, 
     Edit
    )

    This will lookup the unique value - if there is a record with it, then the button will be disabled.

    You could use this same logic on the visible property of a Label that might display "please enter a unique value".

     

    I hope this is helpful for you.

  • Verified answer
    Vijay Tailor Profile Picture
    2,961 on at

    Hi Bolin,

    in that scenario before submitting the form check the value that you are passing is already exists or not.

    if exits in the List then display popup like Found Duplicate.

    else submit the form.

    Like that you can check - Set(CheckDuplicate,Lookup(Datasource,FieldName=ValueYouNeedToPass));

    then use condition to submitting Form.
    if(IsBlank(CheckDuplicate),SubmitForm(FormName),Notify("File Value you are Passing already Present in the Liast , Please Pass the Unique Value"))

    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."


  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @VijayTailor  & @RandyHayes  - Thank you for your responses. I am marking this one as the solution. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard