I have a Security Logout that runs when the page has been inactive for 10 minutes. This works great except if the user has left a form without saving then all their changes are lost. I have one form, in particular, for blog posts which is super easy to get distracted by something else half way through writing and then come back and it’s all gone.
Is there any way to save a forms data before the Security redirect? Bonus points for having that same form open up again in the same place after logging back in!
Could store it all to local storage (Data Store) including the form location. Then check to see if a location is set for the form and browser redirect if contains and standard redirect if nothing… Might take a bit of playing around with but should be quite straight forward. Obviously this would be lost if the user clears their browser cache. Could also clear the Data Store on form submit so there is no residual data playing any part in your redirects. Should be able to do this with a simple Flow? Just a quick idea…
And auto-save option would be better than relying on client side storage.
Setup a timer which keeps auto-saving the form in the DB every few seconds or when a value changes in any of the fields.
Not sure what would work better on your app based on its implementation.
To auto-redirect to last form, after login, just check in the DB to identify an auto-saved form and do a browser.goto based on that response on success of the login SA.
Without that on click event it will logout regardless as soon as the scheduler times out. You only need that code if you want to reset the timer on activity. If you just want it to time out after 10 minutes regardless of activity then just use the scheduler as is.