# Custom Alarm Acknowledge Button

**URL:** <https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420>\
**Category:** Ignition\
**Created:** [September 21, 2017, 12:55am UTC](https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420 "2017-09-21T00:55:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dandersen](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@dandersen](https://forum.inductiveautomation.com/u/dandersen)\
**Post date:** [September 21, 2017, 12:55am UTC](https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420/1 "2017-09-21T00:55:16Z")

</div>

I am trying to create a custom button that acknowledged all unacknowledged alarms in the system. Here is my snippit of code and it isn’t working. Seems like it should from all of the documentation. The table is just so I can see the data.

```auto
from com.inductiveautomation.ignition.common.alarming import EventData
now = EventData()

table = event.source.parent.getComponent("Table")

list = system.alarm.queryStatus(state=["ClearUnacked"])

list[1].acknowledge(now)
table.data = list.getDataset()

```

---

<div class="post-metadata">

**Author:** ![dandersen](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@dandersen](https://forum.inductiveautomation.com/u/dandersen)\
**Post date:** [September 21, 2017, 4:49pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420/2 "2017-09-21T16:49:52Z")

</div>

In working with Tech Support, here is what we came up with.

```auto
stringlist = []

list = system.alarm.queryStatus(state=["ActiveUnacked"])

for id in list:
	stringlist.append(str(id.getId()))
	
system.alarm.acknowledge(stringlist,'')

```

---

<div class="post-metadata">

**Author:** ![manutchaisrichai](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@manutchaisrichai](https://forum.inductiveautomation.com/u/manutchaisrichai)\
**Post date:** [March 7, 2019, 2:34pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420/3 "2019-03-07T14:34:05Z")

</div>

Thanks.😀😀😀😀😀😀

---

<div class="post-metadata">

**Author:** ![nsolomons13](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nsolomons13/32/11441_2.png) [@nsolomons13](https://forum.inductiveautomation.com/u/nsolomons13)\
**Post date:** [October 27, 2019, 8:04am UTC](https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420/4 "2019-10-27T08:04:39Z")

</div>

Thank you for this! I was about to give up on Ignition due to it’s limited alarming functionality.

---

<div class="post-metadata">

**Author:** ![chasondeshotel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chasondeshotel/32/20032_2.png) [@chasondeshotel](https://forum.inductiveautomation.com/u/chasondeshotel)\
**Post date:** [November 12, 2019, 6:08pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420/5 "2019-11-12T18:08:29Z")

</div>

`list` is a Python type, using `list` as a variable name overrides Python’s `list` type and is bad practice. Things like `isinstance(variable, list)` will fail after reassigning `list`

`id` is a builtin function and likewise should not be reassigned

Anyway, this is how I’d do it:

```auto
stringList = [str(alarm.getId()) for alarm in system.alarm.queryStatus(state=["ActiveUnacked"])]
system.alarm.acknowledge(stringList)

```

Or if you insist on not using list comprehension this does the same thing:

```auto
stringList = []
for alarm in system.alarm.queryStatus(state=["ActiveUnacked"]):
	stringList.append(str(alarm.getId()))
system.alarm.acknowledge(stringList)

```

but for the love of FSM _do not use ‘id’ or ‘list’ as variable names_. When the editor highlights a variable name alarm bells should be going off in your head

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [December 2, 2020, 1:07pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420/6 "2020-12-02T13:07:50Z")

</div>

older thread but is there a way to modify this StringList to only acknowledge alarms in an alarm table? Since alarms are global across all clients we filter them based on location in plant. Since filter is done at alarm table level would be nice to ask only those alarms.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [December 2, 2020, 3:17pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420/7 "2020-12-02T15:17:23Z")

</div>

You just change the state= part to “ActiveAcked”  
This is all covered in the docs.

[https://docs.inductiveautomation.com/display/DOC79/system.alarm.queryStatus](https://docs.inductiveautomation.com/display/DOC79/system.alarm.queryStatus)

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [December 2, 2020, 5:03pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420/8 "2020-12-02T17:03:58Z")

</div>

I don’t think that would work…that would acknowledge any active alarm in any client. I need to only ack alarms on the open client’s alarm table. The same app is used in multiple places, and depending on the ‘place’, the alarm table is already filtered to only show alarms applicable to that place. I need to also only acknowledge those alarms with an external button. In that the User Login is unique to each place, I created a client tag for the User Login value, and on the value change of this script, I update the Alarm Table DisplayPath filters. I can use the same conditional scripting to ack by DisplayPath, but thought maybe there was an easy way to just obtain the GetID’s from the table since it’s already doing the filtering.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [December 2, 2020, 5:14pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420/9 "2020-12-02T17:14:52Z")

</div>

Ahh ok, I was confused by your wording.  
You can just do the Ack on the filtered alarm list.

```auto
src = "prov:default:/tag:Path/To/Filtered/Alarm/Folder/*"
results = system.alarm.queryStatus(state=['ActiveUnacked'],source=[src])
for item in results:
	eventID = "%s" % (item.getId())
	system.alarm.acknowledge([eventID], 'None')

```

Replace src with your Source Filter you are using on the alarm status table.

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [December 2, 2020, 5:20pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-acknowledge-button/15420/10 "2020-12-02T17:20:38Z")

</div>

Yep, that’s what I’m doing, but not with Sources…using the Display Paths instead, but same principle. The way the plant set up the Paths previously, it’s a bit cumbersome to try and use sources. Thanks.
