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 / Edits are not retained...
Power Apps
Answered

Edits are not retained in SharePoint Power Apss form with multiple sccreens

(0) ShareShare
ReportReport
Posted on by 53

Hi

I am new to Power Apps and have viewed many on line videos but cannot find answers to my problems.

I have a customised SharePoint form in PowerApps with 4 screens and 4 new forms- the first screen is set to New as a default and the rest are Edit.

  1. When I create a new record, it is overwriting an existing record and is not clearing the last screens.  I select the New button in SharePoint.
  2. When I edit a record through the Edit button in SharePoint, I can edit the information but it is not displaying  the original data in the second to fourth screens.

I have the following code:

SharePointIntegration

OnEdit: Set(IsNew,false);Set(IsEdit,false);EditForm(frmNew);EditForm(frmNewCompliance);EditForm(frmNewService_1);EditForm(frmNewActions);Set(IsEdit,true)

 

OnNew: Set(IsNew,false);Set(IsEdit,false);NewForm(frmNew);NewForm(frmNewCompliance);NewForm(frmNewService_1);NewForm(frmNewActions);Set(IsNew,true)

 

Save button on the first screen

If(

IsNew=true,

  Patch('Service Excellence Framework',Defaults('Service Excellence Framework'),frmNew.Updates,frmNewCompliance.Updates,frmNewService_1.Updates,frmNewActions.Updates);ResetForm(frmNew);ResetForm(frmNewCompliance);ResetForm(frmNewService_1);ResetForm(frmNewActions);,

  Patch('Service Excellence Framework',SharePointIntegration.Selected,frmNew.Updates,frmNewCompliance.Updates,frmNewService_1.Updates,frmNewActions.Updates);ResetForm(frmNew);ResetForm(frmNewCompliance);ResetForm(frmNewService_1);ResetForm(frmNewActions);

);

RequestHide()

I move through the screens through buttons at the top (not a Gallery) and use the Navigate command.

 

Your help would be greatly appreciated.

 

Categories:
  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @Renee ,

    Before I even start on this SharePointIntegration built-in OnSave, OnEdit & OnNew functions were never built with multiple screens/forms in mind and my experience is that the more complex you try to make them, the more likely you will not get the expected result.

    I only ever use these controls for the "base form" and if I need a multi-screen/form app, disable them (simply put false in them all) and give the users buttons as if it was a canvas app. All then will work as expected.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Renee Profile Picture
    53 on at

    Hi Warren

    Thanks so much for your prompt response.  The reason I added code here is that the form is initiated from the SharePoint site through the Edit and New options.  I am not sure how to initiate the form otherwise and how the Update and Create buttons  on the customised form would work.  Sorry for being such a dodo but I am new to this game.

    Thanks, Renee

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @Renee ,

    You basically have the code already - you just need to add it to the appropriate buttons on the relevant screen.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Renee Profile Picture
    53 on at

    Hi

    My confusion is around the fact that the form is initiated from the SharePoint screen so I need to tell it if New is selected that it will create a new record or if Edit is selected that it displays the fields for the record and updates the record with the changes.  Hence, I am not sure where to put the buttons. I apologise for my ignorance.  Also the main issue now is that it picks up the data for the first screen but not for the subsequent screens .Perhaps I should be adding some code for each screen? Thanks so much for your help.

     

     

    image001-2.png
  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    @Renee ,

    Why have you got three screens in the first place? You can use the one form for all three (New/View/Edit) and PowerApps actually sets it up this way. Is there a reason you have added this complication?

  • Renee Profile Picture
    53 on at

    Hi Each screen has different types of data input and formats and one screen has many different pages.  It was easier to format each screen rather than putting them all on one screen which was then extremely long. There are about 50 fields.

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    @Renee ,

    This code OnNew

    Set(IsNew,false);
    Set(IsEdit,false);
    NewForm(frmNew);
    NewForm(frmNewCompliance);
    NewForm(frmNewService_1);
    NewForm(frmNewActions);
    Set(IsNew,true)

    is putting four new forms on the same list. The OnEdit is putting the same forms in Edit mode.

    The OnSave is then either creating a new record or patching all the updated data to the existing record.

    If(
     IsNew=true,
     Patch(
     'Service Excellence Framework',
     Defaults('Service ExcellenceFramework'), 
     frmNew.Updates,
     frmNewCompliance.Updates,
     frmNewService_1.Updates,
     frmNewActions.Updates
     );
     ResetForm(frmNew);
     ResetForm(frmNewCompliance);
     ResetForm(frmNewService_1);
     ResetForm(frmNewActions),
     Patch(
     'Service Excellence Framework',
     {ID:SharePointIntegration.SelectedItemID},
     frmNew.Updates,
     frmNewCompliance.Updates,
     frmNewService_1.Updates,
     frmNewActions.Updates
     );
     ResetForm(frmNew);
     ResetForm(frmNewCompliance);
     ResetForm(frmNewService_1);
     ResetForm(frmNewActions);
    );
    RequestHide()

    Other than the reference on the second patch code (to the ID) and removing a semi-colon after the last reset in the new group, your code is technically correct (and has the intention of producing what you want). However as I said in my first post I have had little success modifying the built-in functions on multi-screen/form apps.

    I will suggest again you simply put these same functions on buttons and disable the built-in controls.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

  • Renee Profile Picture
    53 on at

    Thanks again, Warren. Unfortunately,, the stakeholders do now want to have a form with 2 buttons They want to use the SharePoint Interface to create a new record or to edit a record.  Would it help to add an edit form for each screen?

    Thanks again for your time.

     

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @Renee ,

    I am trying to give you the best answer from my experience with integrated forms - what you are trying works inconsistently at best (as you have found with the form data display). It seems that these forms were designed with a simple one-screen interface in mind, particularly the in-built controls. If you turn them effectively into a canvas app with separate controls, they generally function as you expect (in my experience anyway). As I always do this, it is a bit hard to give you advice on what might work.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Renee Profile Picture
    53 on at

    Thank you - is there a quick way to convert it to a stand alone app without having to start from scratch again? 

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard