# Saving the data to database after specific time out period

**URL:** <https://forum.inductiveautomation.com/t/saving-the-data-to-database-after-specific-time-out-period/57989>\
**Category:** Ignition\
**Tags:** ignition80, database, perspective\
**Created:** [April 4, 2022, 10:29am UTC](https://forum.inductiveautomation.com/t/saving-the-data-to-database-after-specific-time-out-period/57989 "2022-04-04T10:29:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arun\_Teja\_Gattu](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@Arun\_Teja\_Gattu](https://forum.inductiveautomation.com/u/Arun_Teja_Gattu)\
**Post date:** [April 4, 2022, 10:29am UTC](https://forum.inductiveautomation.com/t/saving-the-data-to-database-after-specific-time-out-period/57989/1 "2022-04-04T10:29:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 4, 2022, 12:17pm UTC](https://forum.inductiveautomation.com/t/saving-the-data-to-database-after-specific-time-out-period/57989/2 "2022-04-04T12:17:17Z")

</div>

> [@Arun\_Teja\_Gattu](#):
>
> user status data/UI Data

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

---

<div class="post-metadata">

**Author:** ![Arun\_Teja\_Gattu](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@Arun\_Teja\_Gattu](https://forum.inductiveautomation.com/u/Arun_Teja_Gattu)\
**Post date:** [April 4, 2022, 12:21pm UTC](https://forum.inductiveautomation.com/t/saving-the-data-to-database-after-specific-time-out-period/57989/3 "2022-04-04T12:21:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 4, 2022, 2:20pm UTC](https://forum.inductiveautomation.com/t/saving-the-data-to-database-after-specific-time-out-period/57989/4 "2022-04-04T14:20:42Z")

</div>

_session.props.lastActivity_ was added in 8.1.8.

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

---

<div class="post-metadata">

**Author:** ![Arun\_Teja\_Gattu](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@Arun\_Teja\_Gattu](https://forum.inductiveautomation.com/u/Arun_Teja_Gattu)\
**Post date:** [April 5, 2022, 3:21am UTC](https://forum.inductiveautomation.com/t/saving-the-data-to-database-after-specific-time-out-period/57989/5 "2022-04-05T03:21:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 5, 2022, 11:42am UTC](https://forum.inductiveautomation.com/t/saving-the-data-to-database-after-specific-time-out-period/57989/6 "2022-04-05T11:42:16Z")

</div>

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

You can then use that to trigger your script.

---

<div class="post-metadata">

**Author:** ![Arun\_Teja\_Gattu](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@Arun\_Teja\_Gattu](https://forum.inductiveautomation.com/u/Arun_Teja_Gattu)\
**Post date:** [April 7, 2022, 3:33am UTC](https://forum.inductiveautomation.com/t/saving-the-data-to-database-after-specific-time-out-period/57989/7 "2022-04-07T03:33:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 7, 2022, 8:25am UTC](https://forum.inductiveautomation.com/t/saving-the-data-to-database-after-specific-time-out-period/57989/8 "2022-04-07T08:25:15Z")

</div>

right click on the property suggested by @JordanCClark, then on “Add Change Script”  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/5/b5c62900171cf3677c496fc1d861fedefcdb041e.png)
