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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Editing record in SP s...
Power Apps
Unanswered

Editing record in SP submits new record

(0) ShareShare
ReportReport
Posted on by

@RandyHayes  Yesterday you were kind enough to assist me in getting my OnSave corrected to show an error for Duplicates on the App ID.  It's working great.  However, I believe I inadvertently broke the ability to edit a record and save without it creating a whole new record.  I'm wondering if the OnSave for SharePoint Integration should have something for the If Edit, do this...If New, do this?  Or any ideas how I can fix it?  Here's what you gave me for reference:

 

johannasouth_0-1648569600295.png

 

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

    @Anonymous 

    That should not be the case.  You are using SubmitForm to submit your record.  If your form is in Edit mode and has a valid record, it will update that record when submitted.  If the form is in New mode, then the internal record is empty and it will create a record on submit.  Also, if the form is in Edit mode and the record provided in the Items property is a blank record, then it will also create a new record.

     

    So, if you are editing a record - are you seeing all the details and information in the form that is relevant to that record?

     

    If in doubt on things, please provide:

    - The OnSave action formula of the SPI (SharePointIntegration object)

    - The OnEdit action formula of the SPI

    - The Item property of the form.

    Also, which mentioning things...where is the formula that you provided in this post (that we worked on yesterday) being used?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Anonymous ,

    Try 

    If(
     IsBlank(
     Lookup('Test Automation Governance Report Checklist', 'App ID'=DataCardValue2.Selected.Value
     )
     ), SubmitForm(SharePointForm1),
     Notify(...)
    )
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Drrickryp 

    The formula currently is correct:

    If(
     Lookup('Test Automation Governance Report Checklist', 'App ID'=DataCardValue2.Selected.Value, true), 
     SubmitForm(SharePointForm1),
     Notify(...)
    )

     

    Doing an IsBlank on a lookup is not needed.  If you are testing if a record exists or not, it is important to realize that the third parameter of the LookUp function is what you want to return from the LookUp (normally a column name or a formula of column names, or a calculation).  So, in the above, we want LookUp to return true when the record is found.  Otherwise it will return false.

     

    However @Anonymous problem is with the form now, not with that function.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @RandyHayes 

    OK, I get it but in the screenshot, it shows a "!" in front of the lookup. That seemed weird to me and affected the logic. 

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Drrickryp 

    Yes - that "nots" the true...So in the formula if there is NOT a true record result, then submit, else notify.

  • Community Power Platform Member Profile Picture
    on at

    Yes, when I click on the record, the details are correct.  When I hit Edit in sharepoint on the record, the details are accurate still.  

     

    - The OnSave action formula of the SPI (SharePointIntegration object) - This is the screen shot i provided above.

    - The OnEdit action formula of the SPI - EditForm(SharePointForm1)

    - The Item property of the form - If(IsBlank(SharePointIntegration.Selected) || IsEmpty(SharePointIntegration.Selected),First([@'Johanna Test List']),SharePointIntegration.Selected)

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    Okay...all of the formulas look good!

     

    So, to clarify - you are stating that if you click on a record to edit it, it shows up fine in the form, yet when you click the Save button, it creates a new record in the list and does not update the existing edited record?

  • Community Power Platform Member Profile Picture
    on at

    Correct...To add more clarity, its not submitting a new form because the dup check we put in yesterday is seeing it as a "new record" and wont allow it since that App ID already exists.  

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    Okay...I'm reading between the lines a little here, but the issue is that you're not able to submit the form because, since it is edit, then the record already exists - which makes sense.

     

    So, let's alter that formula then to:

    With(
     LookUp(Test Automation Governance Report Checklist, 
     'App ID'.Value = DataCardValue2.Selected.Value
     ),
    
     If(SharePointIntegration.Selected.ID = ID || IsBlank(ID),
    
     SubmitForm(SharePointForm1),
     Notify("App ID Already Has a Row. Please Find and Update Existing Row")
     )
    )
  • Community Power Platform Member Profile Picture
    on at

    Tried that, still getting our notify message that App ID already has a row.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard