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 / Moving between screens...
Power Apps
Suggested Answer

Moving between screens causing additional record to be created

(2) ShareShare
ReportReport
Posted on by 38
Hello,
 
I have a form that is a one to many form.  Users enter the main details and click a button that does a patch so I can use the ID on the next screen which is the details screen
 
They want to go back to the main screen in case they missed putting in something so I added a icon with the Back().  I added a forward button and added a submitform command and a navigate back to the details screen.  This is creating an additional record.
 
How can I stop this from happening?  
Categories:
I have the same question (0)
  • Suggested answer
    Valantis Profile Picture
    5,479 on at
     
    The duplicate record is happening because you have both Patch and SubmitForm writing to the same list. Patch on screen 1 creates record 1. When the user goes back and clicks forward again, SubmitForm creates record 2 instead of updating record 1.

    The fix is to use Patch on the forward button too instead of SubmitForm, and pass the existing record ID so it updates the existing record rather than creating a new one.

    On screen 1, when the user first submits, store the created record's ID in a variable:
    Set(varRecordID, Patch('YourList', Defaults('YourList'), {Field1: value1, ...}).ID)
     
    Then navigate to screen 2.
    On the forward button on screen 2 when navigating back to details:
    Patch('YourList', LookUp('YourList', ID = varRecordID), {Field2: value2, ...})
    This updates the existing record instead of creating a new one. The key is using LookUp with the stored ID as the second argument to Patch, which tells it which record to update.

    If varRecordID is empty (user hasn't submitted yet), the Patch will create a new record. So make sure the ID is always set before allowing navigation.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

  • Suggested answer
    Kalathiya Profile Picture
    2,211 Super User 2026 Season 1 on at
    Hello @BG-15041758-0

    Usually happens because when the user returns to the main screen the Form is still in New mode, so SubmitForm() creates another new record instead of updating the existing one.

    After your initial Patch/Submit creates the parent record, you should store that record in a variable and switch the form into Edit mode when navigating back.

    First Screen: Form OnSuccess property code will be like this:

    Set(varParentRecord,Self.LastSubmit);
    ResetForm(Self);
    EditForm(Self);
    Navigate(YourSecondScreenName); //YourSecondScreenName - replace with your screen name

    First Screen: Form Item property code will be like this:

    varParentRecord
    This will ensures the form edits the existing record instead of creating a new one.
     
    Also, you can use "varParentRecord" this variable for further other screen patch.
     
    New item submit button code:
    Button - OnSelect Property
    Set(varParentRecord,Blank());
    ResetForm(YourFormName);NewForm(YourFormName); //YourFormName - Replace with your form name
    Navigate(FirstFormScreen); //FirstFormScreen - Replace with your first form screen name
    Gallery - OnSelect code for open the existing item in edit mode:
    Set(varParentRecord,Blank());
    Set(varParentRecord,ThisItem);
    ResetForm(YourFormName);EditForm(YourFormName); //YourFormName - Replace with your form name
    Navigate(FirstFormScreen); //FirstFormScreen - Replace with your first form screen name
     
     
    If this response resolves your issue, please mark it as the Verified Answer so it can help other community members as well.
    ---------------------------------------------------------------------------------

    📩 Need more help? Just mention @Kalathiya and I’ll be happy to assist.

    ✔️ If this answer helped you, please tick “Does this answer your question?” so it can be marked as the Verified Answer.

    💛 A Like always motivates me to keep contributing!

    ​​​​​​​
  • Vish WR Profile Picture
    3,418 on at
     
    The duplicate record issue happens because when the user navigates back to the form, Power Apps switches the form into New mode again. As a result, clicking Submit creates a new item instead of updating the existing one.
    To avoid this, store the first submitted record in a variable and reuse that same record throughout the process.
     
    Screen 1 — Form OnSuccess
     

    Set(varParentRecord, Self.LastSubmit);
    ResetForm(Self);
    EditForm(Self);
    Navigate(YourSecondScreen);
    Screen 1 — Form Item Property
     

    varParentRecord
     
    Screen 2 — Forward Button (Using Patch)

    Patch(
        'YourList',
        LookUp('YourList', ID = varParentRecord.ID),
        {
            Field1: value1
        }
    );
    Navigate(YourSecondScreen);
    New Record Button
    Use this when starting a completely new submission.
     

    Set(varParentRecord, Blank());
    ResetForm(YourFormName);
    NewForm(YourFormName);
    Navigate(FirstFormScreen);
     
     

    Always bind the form’s `Item` property to `varParentRecord` and switch the form into Edit mode after the first save.
    This ensures:
    - Navigating back does not create duplicate records
    - The same SharePoint item continues to update
    - Users can move between screens safely without creating extra entries
  • Vish WR Profile Picture
    3,418 on at
    Wanted to check if you are able to resolve your problem? Let me know if you need any clarification 
     
     
    When replying, please don't forget to mention my userid so that it will be notified 
     
    Vishnu WR
     
    Please  Does this answer your question 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 answering Yes to Was this reply helpful? or give it a Like 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 610

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard