# How to know which user shelved an alarm?

**URL:** <https://forum.inductiveautomation.com/t/how-to-know-which-user-shelved-an-alarm/107352>\
**Category:** Ignition\
**Tags:** ignition81, scripting, perspective\
**Created:** [June 12, 2025, 9:38pm UTC](https://forum.inductiveautomation.com/t/how-to-know-which-user-shelved-an-alarm/107352 "2025-06-12T21:38:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![raees.khan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/raees.khan/32/76218_2.png) [@raees.khan](https://forum.inductiveautomation.com/u/raees.khan)\
**Post date:** [June 12, 2025, 9:38pm UTC](https://forum.inductiveautomation.com/t/how-to-know-which-user-shelved-an-alarm/107352/1 "2025-06-12T21:38:37Z")

</div>

I am using this function `system.alarm.getShelvedPaths` and even using the example code in the manual

However, it is returning `usr:gateway-script` as the user who shelved the alarm. I am getting the same result when when running it in a perspective session

[system.alarm.getShelvedPaths | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-alarm/system-alarm-getShelvedPaths)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 12, 2025, 10:41pm UTC](https://forum.inductiveautomation.com/t/how-to-know-which-user-shelved-an-alarm/107352/2 "2025-06-12T22:41:40Z")

</div>

Where/how are you shelving the alarms? The 'user' return value will depend on where the shelve operation happened - it is identifying the source as a gateway script calling `system.alarm.shelve`.

---

<div class="post-metadata">

**Author:** ![raees.khan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/raees.khan/32/76218_2.png) [@raees.khan](https://forum.inductiveautomation.com/u/raees.khan)\
**Post date:** [June 12, 2025, 10:54pm UTC](https://forum.inductiveautomation.com/t/how-to-know-which-user-shelved-an-alarm/107352/3 "2025-06-12T22:54:37Z")

</div>

I am using a button that has an `onActionPerformed` event. I am using this `system.alarm.shelve` function and passing in an alarm source path in a script.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 12, 2025, 11:24pm UTC](https://forum.inductiveautomation.com/t/how-to-know-which-user-shelved-an-alarm/107352/4 "2025-06-12T23:24:37Z")

</div>

> [@\[IGN-5824\]Ignition - Gateway shelf Alarm script](https://forum.inductiveautomation.com/t/ign-5824-ignition-gateway-shelf-alarm-script/69262/3):
>
> The system.alarm.shelve implementation is hardcoded to use gateway-script as the user ID, likely because it long predates Perspective, and thus there would never be multiple users interacting with the gateway. We can and will amend that to allow for passing more information in, but, in the meantime, you can work around it fairly easy. You'll need to get a GatewayContext - there's examples floating around the forums on how to do that, or you can use [Ignition Extensions](https://forum.inductiveautomation.com/t/ignition-extensions-convenience-utilities-for-advanced-users/64615), my unofficial set of usef…

---

<div class="post-metadata">

**Author:** ![raees.khan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/raees.khan/32/76218_2.png) [@raees.khan](https://forum.inductiveautomation.com/u/raees.khan)\
**Post date:** [June 17, 2025, 3:24pm UTC](https://forum.inductiveautomation.com/t/how-to-know-which-user-shelved-an-alarm/107352/5 "2025-06-17T15:24:21Z")

</div>

Thank you for this. This worked.

However, is there alternative way to get a Gateway context that one can direct me too instead of installing a module in the gateway as the link above instructs to do?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 17, 2025, 4:29pm UTC](https://forum.inductiveautomation.com/t/how-to-know-which-user-shelved-an-alarm/107352/6 "2025-06-17T16:29:32Z")

</div>

There's no supported way to do so statically; once you've reached to the context you are outside the boundaries of supported behavior.  
I'm being deliberately obtuse in the linked post because doing things like this is subject to break between Ignition versions (even minor version changes), **unlike** the guarantees you get with our scripting functions.

That said, Nick has an example in lines 3 and 4 of his script here:

> [@Editing or Creating a Perspective View via Script](https://forum.inductiveautomation.com/t/editing-or-creating-a-perspective-view-via-script/50511):
>
> In case this helps anyone, here’s how you can modify (or create) a Perspective View (or any non-binary resource really) via script. You can call this from any gateway scope, including from a Perspective Button action. Note: the gateway only checks for file updates to resources every 5mins, so you won’t see changes in your client until then, but they will come through automatically. projectName = '' # e.g. 'AwesomeProject' viewPath = '' # e.g. 'Testing/View to Modify' from com.inductiveautomat…
