# Getting session custom property in Gateway Timer Script

**URL:** <https://forum.inductiveautomation.com/t/getting-session-custom-property-in-gateway-timer-script/73778>\
**Category:** Ignition\
**Created:** [May 16, 2023, 1:22pm UTC](https://forum.inductiveautomation.com/t/getting-session-custom-property-in-gateway-timer-script/73778 "2023-05-16T13:22:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_John](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@John\_John](https://forum.inductiveautomation.com/u/John_John)\
**Post date:** [May 16, 2023, 1:22pm UTC](https://forum.inductiveautomation.com/t/getting-session-custom-property-in-gateway-timer-script/73778/1 "2023-05-16T13:22:27Z")

</div>

Can anyone suggest how to get the session custom property and the logged in user name in the gateway timer script?

Thanks

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [May 16, 2023, 1:44pm UTC](https://forum.inductiveautomation.com/t/getting-session-custom-property-in-gateway-timer-script/73778/2 "2023-05-16T13:44:02Z")

</div>

Gateway scripts will be in a different scope (_gateway_ scope rather than _session_ scope), and will not be tied to a particular session. The script would not know which session to target.

What are you trying to achieve with the script?

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [May 16, 2023, 2:08pm UTC](https://forum.inductiveautomation.com/t/getting-session-custom-property-in-gateway-timer-script/73778/3 "2023-05-16T14:08:40Z")

</div>

You could possibly do this using [system.perspective.getSessionInfo](https://docs.inductiveautomation.com/display/DOC81/system.perspective.getSessionInfo) and [system.util.sendRequest](https://docs.inductiveautomation.com/display/DOC81/system.util.sendRequest). (Links are to IA docs.)

It looks like calling `system.perspective.getSessionInfo()` returns a list of objects. Each object represents one session and includes the session ID, username, project, and lots of other information. You could send a request using `system.util.sendRequest` to each Session that's running an appropriate project. That project would need to have a message handler that was configured to send back the custom property you're trying to acquire.

All that said, I echo @djs in asking, "What are you trying to achieve?" There's maybe a more elegant solution than what I've described here.

---

<div class="post-metadata">

**Author:** ![John\_John](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@John\_John](https://forum.inductiveautomation.com/u/John_John)\
**Post date:** [May 17, 2023, 4:42am UTC](https://forum.inductiveautomation.com/t/getting-session-custom-property-in-gateway-timer-script/73778/4 "2023-05-17T04:42:47Z")

</div>

The machines are categorised under different module. The selected module information will be there in session. I need to open the popup if there is any alarm for the selected equipment. Currently opening popup is handled in timer script. In timer script i need to fetch the selected machine information from the session custom property.

---

<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:** [May 17, 2023, 11:11am UTC](https://forum.inductiveautomation.com/t/getting-session-custom-property-in-gateway-timer-script/73778/5 "2023-05-17T11:11:23Z")

</div>

> [@John\_John](#):
>
> Currently opening popup is handled in timer script.

"Currently" meaning some other HMI that you are trying to duplicate? Standalone HMIs don't have multi-user capabilities and don't have any notion of "scope". Ignition does.

In Ignition, opening popups must happen in a client/session scope. Full stop.

---

<div class="post-metadata">

**Author:** ![John\_John](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@John\_John](https://forum.inductiveautomation.com/u/John_John)\
**Post date:** [May 17, 2023, 11:55am UTC](https://forum.inductiveautomation.com/t/getting-session-custom-property-in-gateway-timer-script/73778/6 "2023-05-17T11:55:20Z")

</div>

Developing Application in perspective. Currently alarm popup is displaying for all machines. But I need to open the popup for only the selected machines. Selected machine information will be there in session custom property.

---

<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:** [May 17, 2023, 12:11pm UTC](https://forum.inductiveautomation.com/t/getting-session-custom-property-in-gateway-timer-script/73778/7 "2023-05-17T12:11:10Z")

</div>

Have the timer event send a message to your sessions (using `system.util.sendMessage` with `scope='S'`) and have the session message handler examine the custom property. Include enough information in the message for that message handler to make the decision about opening the popup.

---

<div class="post-metadata">

**Author:** ![John\_John](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@John\_John](https://forum.inductiveautomation.com/u/John_John)\
**Post date:** [May 17, 2023, 1:26pm UTC](https://forum.inductiveautomation.com/t/getting-session-custom-property-in-gateway-timer-script/73778/8 "2023-05-17T13:26:19Z")

</div>

Its working. Thanks
