# \[IGN-5824\]Ignition - Gateway shelf Alarm script

**URL:** <https://forum.inductiveautomation.com/t/ign-5824-ignition-gateway-shelf-alarm-script/69262>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [February 1, 2023, 9:11am UTC](https://forum.inductiveautomation.com/t/ign-5824-ignition-gateway-shelf-alarm-script/69262 "2023-02-01T09:11:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Giske](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/richard_giske/32/41906_2.png) [@Richard\_Giske](https://forum.inductiveautomation.com/u/Richard_Giske)\
**Post date:** [February 1, 2023, 9:11am UTC](https://forum.inductiveautomation.com/t/ign-5824-ignition-gateway-shelf-alarm-script/69262/1 "2023-02-01T09:11:47Z")

</div>

I have an alarm script used to shelf alarms, and this script runs on the gateway.  
It works like a charm, except that the alarm always shows as "shelved by :gateway script" in the "Shelved alarm" view.

Is there a way to add the user info instead of the "gateway script", so that it is possible to see who shelved the alarms?  
(I have the user info available, just can't seem to find anywhere to insert it).

---

<div class="post-metadata">

**Author:** ![kyler.kamyszek](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@kyler.kamyszek](https://forum.inductiveautomation.com/u/kyler.kamyszek)\
**Post date:** [February 1, 2023, 1:08pm UTC](https://forum.inductiveautomation.com/t/ign-5824-ignition-gateway-shelf-alarm-script/69262/2 "2023-02-01T13:08:39Z")

</div>

If you run the script in perspective (client side) does it have the same 'shelved by'?

Otherwise, maybe using the Notes property could give you the same affect.

---

<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:** [February 1, 2023, 4:41pm UTC](https://forum.inductiveautomation.com/t/ign-5824-ignition-gateway-shelf-alarm-script/69262/3 "2023-02-01T16:41:41Z")

</div>

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 useful scripting modules. Once you _have_ a context, all you have to do is:

```python
from com.inductiveautomation.ignition.common import QualifiedPath

def shelve(paths, timeout, userName):
    paths = [QualifiedPath.parse(stringPath) for stringPath in paths]
    user = QualifiedPath.Builder().setUser(userName).build()
    gwContext = # obtain a gateway context
    gwContext.getAlarmManager().shelve(paths, timeout, user);

```

---

<div class="post-metadata">

**Author:** ![Richard\_Giske](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/richard_giske/32/41906_2.png) [@Richard\_Giske](https://forum.inductiveautomation.com/u/Richard_Giske)\
**Post date:** [February 3, 2023, 10:06am UTC](https://forum.inductiveautomation.com/t/ign-5824-ignition-gateway-shelf-alarm-script/69262/4 "2023-02-03T10:06:39Z")

</div>

Thanks @paul-griffith , I'll try this one with your extension modules.

The "paths "input on the function, what data is expected there?  
and the timeout, is that the shelving time in minutes?

---

<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:** [February 3, 2023, 4:17pm UTC](https://forum.inductiveautomation.com/t/ign-5824-ignition-gateway-shelf-alarm-script/69262/5 "2023-02-03T16:17:42Z")

</div>

The paths argument should be interpreted just as it is for the `system.alarm.shelve` function. The timeout argument is in seconds.
