Saving the data to database after specific time out period

Hi All,
I want to save the user status data/UI Data to the database if the user is inactive for specific time interval(15 minutes).
so is there a way this can be achieved in ignition perspective with script or any properties that can help in the ignition version 8.1.7.
Looking forward to hear from you.

Thanks in advance

What is "user status data/UI Data"? Why do you want to save it?

The User status data is the data of the specific user saved to database to know whether the user is active or inactive

session.props.lastActivity was added in 8.1.8.

https://docs.inductiveautomation.com/display/DOC81/Session+Properties#SessionProperties-SessionPropertiesTable

Can we trigger any functions or script when session is timed out?

Make a custom session property with an expression similar to:
minutesBetween({this.props.lastActivity}, now())

You can then use that to trigger your script.

Hello,
This script can be used but I need an option to auto trigger this script when the difference reaches to 15 minutes.
Is that possible by any chance. If yes, can you please suggest the way or script.

right click on the property suggested by @JordanCClark, then on “Add Change Script”
image