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 / Open last active scree...
Power Apps
Answered

Open last active screen after power was closed down

(0) ShareShare
ReportReport
Posted on by 73

I have built a power app to be used on a mobile by different people. Screens are to be used in a specific order which works fine. However, when the apps gets closed (eg. mobile turned off), then when re-opening the app, it starts all over at the beginning (start screen) where I would need the app to go to the last active screen that was used by that specific user. How can I make that happen ?

Categories:
I have the same question (0)
  • TheRobRush Profile Picture
    11,128 Moderator on at

    You'd probably need to use SaveData, LoadData, to create checkpoints every time a user changed screen, and then Reference the value of that in the StartScreen of the app via a switch or something to set the start page

  • MarcB1966 Profile Picture
    73 on at

    I know.  But I'm certainly not an experienced user and I keep stumbling onto error messages (and to be fair - I've been trying to find a solution with ChatGTP, but that didn't workout sofar)

     

  • TheRobRush Profile Picture
    11,128 Moderator on at

    ChatGPT is terrible at powerapps. Give me a minute and I will write something up for you

  • MarcB1966 Profile Picture
    73 on at

    I know.  Experienced that the hardway meanwhile.  Thx 🙂

  • Verified answer
    TheRobRush Profile Picture
    11,128 Moderator on at

    ok so didn't work 100% the way I initially envisioned it. Forgot global variables are not accessible from the StartScreen property.

     

    THAT being said I do have it working and here is how it works.

     

    Everywhere you navigate to a new screen place this right before the navigate 

     

    ClearCollect(lastPage,"laneScan");
    IfError(SaveData(lastPage, "pageReturn"),false);

     

     

    replace "laneScan" with a reference you will remember for that page later, doesn't need to be exact page name laneScan on mine is the page called LaneScanners but i wanted every ref to be same format for sanity so i just made them all xyzScan abcScan defScan etc.

     

    on any navigate that returns to the main landing page place 

     

    Clear(lastPage);
    IfError(ClearData("pageReturn"),false);

     

     

    In your OnVisible of main lkanding page place this 

     

    IfError(LoadData(lastPage,"pageReturn",true),false)
    

     

     

    on that landing page place a button with a visible property of 

     

    !IsEmpty(lastPage)

     

    give it a text property of something like continue or return to last page etc and an OnSelect of 

     

    Switch(
     First(lastPage).Value,
     "laneScan", Navigate(LaneScanner),
     "exitScan", Navigate(ExitScanner))

     

    where you replace "laneScan" etc with the refs you made, and the Navigates pointing to their corresponding pages

     

    This gives youa continue button that only appears if they recently were ona  different page etc, and that code we put in the nav back to home cna also be put in a completion of the task button etc so that it only shows up to resume when they left app mid task

  • MarcB1966 Profile Picture
    73 on at

    Rob, ... If I get that actually to work, then ... you're a genius 🙂

    Just to make no conceptual mistake ... where you start with "Everywhere you navigate to a new screen place this right before the navigate".  In my case, navigating to the next screen is based on a button that needs to be 'tapped'.  Would that mean that I need to embed that formula before the 'Navigate' function which has "OnSelect" Property ?

  • TheRobRush Profile Picture
    11,128 Moderator on at

    correct, in my test example i also place it on a button and the FULL button code looked like this 

    ClearCollect(lastPage,"laneScan");
    IfError(SaveData(lastPage, "pageReturn"),false);
    
    Navigate(LaneScanner,ScreenTransition.Fade);
  • MarcB1966 Profile Picture
    73 on at

    Rob,    

    The good thing is ... no error messages (as opposed to all previous ChatGTP efforts 🙄)

    The bad thing is, ... it is not (yet) working.  Therefor, I must be overlooking something.

     

    Allow me to recapitulate what I've done so far (for a limited number of screens.  I assume if the first ones are actually working, that I can complete all others the same way ?)

     

    Everywhere where there is a button to navigate to the next screen, I've embedded your suggestion.  That would look like this :

    ServTimeRegistrFlow.Run(
    User().FullName,"Start TravelFROMHome","",Location.Longitude,Location.Latitude,Now(),DailyID,"",
    "CustomerDropdown.Selected.Value",
    "SC_HomeStopTravelCust"
    );

    ClearCollect(LastPage, "SC_HomeIdentifyCustomer");
    IfError(SaveData(LastPage, "PageReturn"),false);

    Navigate(SC_HomeStopTravelCust,ScreenTransition.CoverRight)

     

    (sorry for the layout.  Haven't figured out yet how you squeeze those rectangles).

    The first part of the formula is referring to an automated flow in order to push some data into a Sharepoint list.

     

    The other pages/screens have a similar formula in the "OnSelect" property.

     

    In the OnVisible of the main landing page ...

    IfError(LoadData(LastPage, "pageReturn", true), false)

    On the same landing page place, a button was created with a visible property

    !IsEmpty(LastPage)

     

    Text property to that button :

    "Tap this button if you need to go back to your last active page"

    This however shouldn't have any impact on 'operational' side of the process

     

    And finally - still the same button - in the OnSelect property :

    Switch(
    First(LastPage).Value,
    "SC_HomePurposeTravel", Navigate(SC_HomePurposeTravel),
    "SC_HomeIdentifyCustomer", Navigate(SC_HomeIdentifyCustomer),
    "SC_HomeStopTravelCust", Navigate(SC_HomeStopTravelCust)
    )

     

    If you still feel up for it, would be grateful if you could point out where I'm missing out on something ...

    Much obliged.

    (probably will be out for the remainder of the evening - close to 18h now)

     

  • TheRobRush Profile Picture
    11,128 Moderator on at
    IfError(SaveData(LastPage, "PageReturn"),false)
    IfError(LoadData(LastPage, "pageReturn", true), false)

     

    See anything different?

  • MarcB1966 Profile Picture
    73 on at

    Genius and eagle eyes.  I've aligned them both to be 'PageReturn'.  Consistency in syntax is a lovely thing.

    But - unfortunately (after republishing etc ...) - still not working.

    Anything else I should try/check ?

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