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 / Automatically refresh ...
Power Apps
Answered

Automatically refresh Powerapp and return to Screen 1 after patching to Sharepoint.

(1) ShareShare
ReportReport
Posted on by 32
Hello
 
I have built an app to record various assets and maintenance schedules in different locations. The app is working and making records in Sharepoint as expected. Woohoo!
 
Now I'm trying to work out how to have the app automatically refresh and return to Screen 1 after patching the record to Sharepoint. 
 
Otherwise, is there any formula that will automatically move to a fresh screen following submission of the asset record? 
 
The app will be used by multiple people, and I would like to reduce the probability of duplicate entries. 
 
Hi . You very kindly helped me get this far. Do you have any advice for this next, and hopefully final step? 
 
Cheers
James
Categories:
I have the same question (0)
  • Verified answer
    SebS Profile Picture
    4,826 Super User 2026 Season 1 on at
    there is few ways to do it 

    Option one if it's a form

    Refresh('The Assets List');
    ResetForm(frmAsset);
    NewForm(frmAsset);
    Navigate(Screen1, ScreenTransition.Fade);
    Notify("Asset record submitted successfully.", NotificationType.Success);

    option two if it's a patch

     
    IfError(
        Patch(
            'The Assets List',
            Defaults('The Assets List'),
            {
                Title: txtAssetName.Text,
                Location: drpLocation.Selected.Value,
                MaintenanceDate: dpMaintenanceDate.SelectedDate
            }
        ),
        Notify("Something went wrong. The asset was not saved.", NotificationType.Error),
        Refresh('The Assets List');
        Reset(txtAssetName);
        Reset(drpLocation);
        Reset(dpMaintenanceDate);
        Navigate(Screen1, ScreenTransition.Fade);
        Notify("Asset record submitted successfully.", NotificationType.Success)
    )
     
  • MarkRahn Profile Picture
    1,418 Super User 2026 Season 1 on at
    Based on what you are asking, @SebS has the right approach.
     
    When I am writing a reply, I always hit refresh to see if someone beat me to it. And @SebS did ;)
     
    This community is supported by individuals freely devoting their time to answer questions and provide support. They do it to let you know you are not alone. This is a community.

    If someone has been able to answer your questions or solve your problem, please click Does this answer your question. This will help others who have the same question find a solution quickly via the forum search.

    If someone was able to provide you with more information that moved you closer to a solution, throw them a Like. It might make their day. 😊

    Thanks
    -Mark
  • Verified answer
    Kalathiya Profile Picture
    2,456 Super User 2026 Season 1 on at
     
    Glad to hear the app is working fine now.
     
    Sabs Approach is also correct. 
     
    Yes, after the Patch() you can simply add below things:
    #1. Refresh the SharePoint list
    #2. Reset the controls.
    #3. Navigate back to Screen 1
     
    IfError(
    
        Patch(
            'Assets List',
            Defaults('Assets List'),
            {
                'Maintenance Tasks':MainTasksCombo.SelectedItems, //If it;s single select choice then replace SelectedItems to Selected
                'Maintenance Frequency':MainFreqCombo.SelectedItems
            }
        ),
    
        Notify("Error while saving record", NotificationType.Error,2500),
    
        Refresh('Assets List');
        Reset(MainTasksCombo);
        Reset(MainFreqCombo); //Add all the controls here for Reset. 
        Navigate(Screen1, ScreenTransition.None);
        Notify("Record saved successfully", NotificationType.Success,2500)
    
    )
     
    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!

     
  • WarrenBelz Profile Picture
    155,838 Most Valuable Professional on at
    I will add something here - if your (I assume a) gallery on Screen 1 is based directly on the SharePoint list (not a collection), then you should not need to refresh the data source as all controls on a screen will reset and requery any data source they are linked to when opening the screen. If it is based on a collection, then you need to re-collect to get the updated data.
  • Ram Prakash Duraisamy Profile Picture
    5,877 Super User 2026 Season 1 on at
     
    You can achieve this by using below code after Patch
     
    Refresh(YourSharePointList);
    ResetForm(Form1);
    Navigate(Screen1, ScreenTransition.Fade)
     
    Please mark as answer if my suggestion helps.
    Subscribe here for More Useful videos : https://www.youtube.com/@rampprakash3991
  • JM-20031104-0 Profile Picture
    32 on at
      : thank you both. Apologies for the delayed reply- I've been ooo for a few days. 
     
    After adding that string after the Patch , I'm getting a number of errors regarding expected characters. 
     
    To clarify: does If(Error  get pasted before my original Patch code? or do I paste it after the Patch code and then repeat the entire Patch code? 
     
    Either way, is there a closing parenthesis missing from the string? and if so, should it precede the Refresh code or should it go at the end of everything?
  • Verified answer
    Kalathiya Profile Picture
    2,456 Super User 2026 Season 1 on at
     
    No worries.

    IfError() should wrap around your entire existing Patch statement, you do not paste it before and then repeat the Patch again separately.

    Syntax like this:

    IfError( 
               Patch(...), 
              //Error handling 
               Notify("Error while saving", NotificationType.Error), 
               
              //Success actions 
              Refresh(...); 
              Reset(...); 
              Navigate(...) 
    )
    Try this:
     
    IfError(
    
        Patch(
            'Assets List',
            Defaults('Assets List'),
            {
                'Maintenance Tasks':MainTasksCombo.SelectedItems, //If it;s single select choice then replace SelectedItems to Selected
                'Maintenance Frequency':MainFreqCombo.SelectedItems
            }
        ),
    
        Notify("Error while saving record", NotificationType.Error,2500),
    
        Refresh('Assets List');
        Reset(MainTasksCombo);
        Reset(MainFreqCombo); //Add all the controls here for Reset. 
        Navigate(Screen1, ScreenTransition.None);
        Notify("Record saved successfully", NotificationType.Success,2500)
    
    )
    Please try above code. Also, please send the error screen shot if you are getting anything. 
     
    If this response resolves your issue, please mark it as the Verified Answer so it can help other community members as well.
  • JM-20031104-0 Profile Picture
    32 on at
    Hi  That worked. Thanks!
     
    After fixing the IfError I was down to a single error referring to Resettable Controls, but tracked it down to a Captured Image, which it didn't recognise as resettable. Is that always the case for Captured Images? 
     
    Looking into that control, I have another glitch that I can't work out. As you can see in the screenshots below, the gallery skips the first box, and displays the image in the second box. When I delete the image as in the middle picture, it still displays the 2 boxes. I'd be happy to just capture 1 image, but I can't figure out how to change that. I'd also like it to be resettable at Patch, to prevent the probability that someone would allocate the wrong image to an asset. 
    The third screenshot shows the gallery from the canvas design page with the highlighted box being the
    Image: ThisItem.Photo. 
    The fourth picture shows the structure of the screen, with the camera and gallery sitting within a scrolling container. 
     
     
  • Suggested answer
    Kalathiya Profile Picture
    2,456 Super User 2026 Season 1 on at
    Hello @JM-20031104-0

    Glad you got the IfError() part working, thanks for updating.

    Reset function will not work with Camera. 

    Camera button code something like:

    ClearCollect( colPhoto, { Photo: Camera1.Photo } )
    Then set Gallery Items:
    colPhoto
    Remove button in galley
    Remove(colPhoto, ThisItem);
    If possible, could you please share:
    - Gallery Items formula
    - Camera button OnSelect formula
    - Whether using Camera control or Add Picture control
     
    If this response resolves your issue, please mark it as the Verified Answer so it can help other community members as well.
  • JM-20031104-0 Profile Picture
    32 on at
    Gallery formula is Items: colPhotos
     
    Capture Button is OnSelect: If(
        CountRows(colPhotos) < 3,
        Collect(colPhotos, { Photo: Camera1_1.Stream })
    )
     
    Image is Image: ThisItem.Photo
     
    Trash Icon is OnSelect: Remove(colPhotos, ThisItem)
     
    I've worked out the correct patch string:
     
    ClearCollect (colPhotos, {Photo:Camera1_1.Stream});
     
     
    It now seems to be working and the issue with the image only saving from the second row onwards has also evaporated. 
     
    All good (for now :) )
     
    Thanks again for all of your help. I really appreciate it. 
     
    I tried to build this app with instructions from Co-Pilot - I wasted so much time with incorrect information and wrong turns. I can't tell you how frustrating it was!!! Who'd have thought that Microsoft's own AI might know something about other Microsoft software?!
    Anyway, good to know that humans still rule! Thank you all. 
     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard