# Add change Script to the session.props.id

**URL:** <https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522>\
**Category:** Ignition Early Access\
**Tags:** perspective\
**Created:** [October 16, 2023, 10:00am UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522 "2023-10-16T10:00:30Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [October 16, 2023, 10:00am UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/1 "2023-10-16T10:00:30Z")

</div>

Hi

I try to catch the event when someone opens the designer and saves the user info in the database. I try to put my code in the change script event of session.props.id but it seems Ignition can't detect the changes of this property.

Also, Perspective \> Session Events \> Startup doesn't trigger when the designer is opened.

So, I am looking for a location to give me an event when the designer opens.

Calling system.perspective.getSessionInfo() periodically gives this information but the problem is not efficient and I need to poll the function.

---

<div class="post-metadata">

**Author:** ![Hayden\_Watson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hayden_watson/32/48792_2.png) [@Hayden\_Watson](https://forum.inductiveautomation.com/u/Hayden_Watson)\
**Post date:** [October 16, 2023, 10:53am UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/2 "2023-10-16T10:53:46Z")

</div>

Isn't this logged already on the Audit log, could you query that and pull the information across to your new table?

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [October 16, 2023, 11:21am UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/3 "2023-10-16T11:21:42Z")

</div>

No the logout info in audit has no information about who logout

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [October 16, 2023, 12:02pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/4 "2023-10-16T12:02:13Z")

</div>

What's going wrong exactly, what is the designer saving in user info you are trying to catch? Are you trying to prevent the designer from overwriting something for user info, or just log when the designer makes changes to it for record keeping?

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [October 16, 2023, 12:22pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/5 "2023-10-16T12:22:19Z")

</div>

> [@bkarabinchak.psi](#):
>
> user

I just want to track user activities on the designer. So I want when someone open the designer and close it I get event and save his/her info into my database.  
info:  
username  
project  
sessionId  
usersource/idp  
loginTime  
logoutTime

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 16, 2023, 12:26pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/6 "2023-10-16T12:26:24Z")

</div>

This is almost trivial in an SDK module. Time to learn a little java, I think. 😀

---

<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:** [October 16, 2023, 12:35pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/7 "2023-10-16T12:35:18Z")

</div>

This is where I get confused because that should be in the audit log, shouldn't it?

A quick sample of me doing a few things in the designer:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/b/8bbf7327e6b00c0a7361be5410de0495e82ef339.png)

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [October 16, 2023, 12:44pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/8 "2023-10-16T12:44:08Z")

</div>

The problem is each project may use a different audit database and it is hard to track developer work in different databases.

I need something centralized in one database. Also in the audit, there is no record of idp and sessionId( I need sessionId to match the pair of login/logout)  
Maybe there is two user name in different idp(usersource)

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [October 16, 2023, 12:46pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/9 "2023-10-16T12:46:30Z")

</div>

an expression binding(with just a string in it or whatever) on a session.custom prop with a script transform attached to it seems to trigger once on launch. Might trigger extra on edits though

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 16, 2023, 1:03pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/10 "2023-10-16T13:03:10Z")

</div>

> [@nader.chinichian](#):
>
> there is no record of idp

The designer itself does not use the project's authentication settings.

---

<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:** [October 16, 2023, 1:03pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/11 "2023-10-16T13:03:45Z")

</div>

For clarity, these events would be in the gateway auditing-- just one log regardless of project.

---

<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:** [October 16, 2023, 1:06pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/12 "2023-10-16T13:06:18Z")

</div>

> [@pturmel](#):
>
> The designer itself does not use the project's authentication settings.

If the designer authentication uses an idp instead of 'Classic', would there still be a session id of sorts? Just not something that get's used in the log?

EDIT: I realize that's starting to go off into the weeds, but maybe something to look into for 8.3

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [October 16, 2023, 1:07pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/13 "2023-10-16T13:07:46Z")

</div>

The project accepts one audit profile and this profile is different for each project.  
If you miss this setting nothing will log for user activities in desinger.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/f/6fe242193af33e7a7ad3014b31ea14d686c0cf2f.png)

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [October 16, 2023, 1:09pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/14 "2023-10-16T13:09:10Z")

</div>

No, actually we use idp now for designers.

We want to create some sort of admin tool to visualize users' activities including both clients (operators) and developers. The problem is the user runtime activities log as Unauthenticated in the audit for both login/out.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/f/6f6ac132dc629bb62bff2789a711ae1da1a8a77c.png)

At the same time if I use Perspective session startup and shutdown it doesn't catch designer.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [October 16, 2023, 1:30pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/15 "2023-10-16T13:30:45Z")

</div>

wasnt that fixed after you did this?

> [@Designer can't get username in Perspective](https://forum.inductiveautomation.com/t/designer-cant-get-username-in-perspective/79958/13):
>
> Thanks this solves my problem. The problem is I use Idp but it seems someone by mistake made the designer permission role field empty.

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [October 16, 2023, 1:33pm UTC](https://forum.inductiveautomation.com/t/add-change-script-to-the-session-props-id/80522/16 "2023-10-16T13:33:50Z")

</div>

Yes and no, as you mentioned the session startup and shutdown don't trigger the event change script. So even if I use binding in the custom part, I definitely lose the shutdown events in the designer.
