cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DDCJOEE
Advocate III
Advocate III

Triggering an event when app is closed

I am working on an app where I want an action to execute when the app is closed. Specifically, I want to use the slack connector to send a chat to a channel notifying my team that a user is done using the app.

 

I know there's the OnHidden function for a page, but my guess is that only works when navigating away from the screen while the app is still open.

 

Is anything similar where I could have the app execute a function when the user closes out of the app?

4 REPLIES 4
mdevaney
Super User
Super User

@DDCJOEE 

Nope, not in Power Apps.  You can vote for the idea here:
https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Application-Close-Event/idi-p/91556

 

What you can do instead is execute a function when the user finishes a process (e.g. clicks submit button).  This is a better design pattern because the user knows their work was sent successfully.  If there was an error, the user would never know.


---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

RandyHayes
Super User
Super User

@DDCJOEE 

As @mdevaney mentioned, there is NO current OnAppClose action that you can hook onto.  

The best you can do currently is to provide a Close button/icon/etc that a user must use to close the App.  You can intercept the app closing by using the ConfirmExit property of the App.  In that you can set the ConfirmExitMessage property to tell the user they need to click on your button/icon/etc to close the app - However unfortunately, that dialog that opens presents two buttons to ask the user if they want to cancel or close.  There is nothing that keeps them from just clicking on close.

BUT...it's something and perhaps may be helpful for you in the meantime while we wait for an OnClose action.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
mdevaney
Super User
Super User

@RandyHayes 

I personally don't hold out much hope for the OnExit event.  People would probably overload it with way too much stuff like they do OnStart.  

But yeah, even a close button with the Exit() function doesn't prevent anything. IMHO, the original poster must train those users how to use the app properly and show a confirmed save message in the app.

RandyHayes
Super User
Super User

@mdevaney 

I'm not holding my breath for it!!  And yes, I can only imagine how much stuff people would try to stuff into the OnExit.  Yikes!!

 

I believe it would be nice to at least allow some control over the ConfirmExit where you can prevent it from showing the "Exit" option.  So that the user would have to go back to the app and exit properly from there.

 

The only place I've ever really run into this factor has been on Offline apps where there might be some "fresh" information that can't be sent to the mothership because of no connect and we have not saved it to the device for later processing.  In those cases, we give a stern warning in the exit message that they WILL LOSE DATA.  That seems to stop them to some degree.  Or at least, when they come complaining that they lost data, we can point back to the warning they were given.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,229)