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 / Button losses there st...
Power Apps
Unanswered

Button losses there state after refreshing the App

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello Experts,

 

I have one Power App which work on four button four submission concept. On first entry users fills the data presses the first  button and submit the data , on button i have set a variable which make button display  disable after pressing the button.

Now after some time user user presses button 2 and submit the data. same way after the hours gap user presses button 3 and then button 4  and completes the process.

Sometimes Apps crash  and  reinitialize on the phone and sometimes user kill/refresh the App after submissions. both ways all the last states of button doees not maintain , it made all enable.

As pressed button loss their state after refresh or killing the App, is there any way so i could preserve the button last state even after refreshing the page or killing the App. This way i want to make sure user that which button he has pressed before so he could not make any mistake by pressing button again.

This is the formula i am writing for button Press.

On Select button : Set(buttonPressedTStart,true)

Display Mode button: If(buttonPressedTStart,Disabled,Edit) 

Categories:
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous Set creates a Global variable. It is a transient variable, meaning when the App closes the value is lost. If you want to reload this information you have to store it permanently. You can use an Excel sheet, Share Point list etc., to do that. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @CNT , Thanks for looking into this issue, other form data i am storing in Share point list  after submission it doesnt lost. but i just want to maintain the button display state for example if button was pressed in last submission how it will remain pressed even after refresh.

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous I understood you requirement very well. You want the App to "remember" where the user was before the App was closed. For this you have to store that information somewhere. You can have another SP list with one column for the UserEmail and another for the LastPressedButton.  Each time the user presses a Button save this information it to this record. When the App opens read this information and set the right buttons enabled/disabled. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @CNT  sorry for the late response , as you advised i have added one column in my SP list and added this to my form on power app. now at each button click this filed will get different value as per the respected button pressed.

    but here i believe variable will also loss their state after refresh/Kill the App. 

    this is how i am setting value of variable.

    UpdateContext({LBP: "TStart Pressed"});

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous Could you please share your screen for me to get a better idea of what you are up to.

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous It would be easier if you just sent me some screen shots!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @CNT Please see the screen shot below.

    Capture109.PNG

    i have 4 button on my App, user press one button and submits the form , each button press after a time duration like hours. some times during this duration app gets killed or crashed or refresh , As when user reopens the app he gets all button enabled not the last one he pressed.

    As you advised i have created one column "LastBUttonPressed" in my SP list and added in the form , on each button click this field gets different value and store in SP list. till here everything is fine. here is the issues now.

    1. now i should enable or disable the button based on the value stored in SP list field (How i will do that )

    2.if i will use the if condition and use the LastBUttonPressed field to make condition , after refresh this field has no data.

    3.can i make condition directly from SP list , not the datacardvalue of App?

     

    Please let me know for more clarity.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello All ,

     

    I tried something here , i am putting one IF condition on Display mode of the button. below is the condition 

    If(('BG Activity Recorder'.LastButtonPressed) ="TStart Pressed",Edit,Disabled)

    Since i have added column in the Same SP list , is it a issue ? Also my doubt was why we need to create a seprate SP list and an additional column of USerEmail

    BG Activity Recorder is my SP list, i have added one column "LastButtonPressed" in the same list where i am storing other data.

    now this function is giving error "."Invalid Argument type"", 

    Capture113.PNG

  • SachinG31 Profile Picture
    422 on at

    Dear all, 

     

    My this issue have solved in another Post , if you have the same requirement , GO HERE

    Link  

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
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard