# Custom alarm roster does not send

**URL:** <https://forum.inductiveautomation.com/t/custom-alarm-roster-does-not-send/84336>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [January 16, 2024, 6:00pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-roster-does-not-send/84336 "2024-01-16T18:00:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [January 16, 2024, 6:00pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-roster-does-not-send/84336/1 "2024-01-16T18:00:21Z")

</div>

###### you probably saw this one coming...

if i use a pre-built roster with a `Direct` contact type, emails get sent on alarm as expected. we need to filter alarm emails on a per-asset basis, so i whipped up the following script, which generates the correct object for the email engine:

```python
users = system.user.getUsers('TurboUsers') #<-- blank = default user source
currentAsset = str({displayPath})
alarmEmailList = []

for user in users:
  userRoles = user.getRoles()
  username = user.get('username')
  if ('spanky' in userRoles) and user.getContactInfo():
    userContactInfo = str(user.getContactInfo()[0])
    # gives 'email: floop@doop.ca'. yes. a string.
    if 'email' in userContactInfo:
      emailEntry = {}
      if userFunctions.singleUserFunctions.canUserDo(currentAsset, username, 'isNotified'):
        userEmail = userContactInfo.replace('email: ', '')
        emailEntry['username'] = username					
        emailEntry['email'] = [userEmail]
        alarmEmailList.append(emailEntry)

return alarmEmailList

```

so this will generate and return a list of dicts, as expected and required:

```json
[
  { 'email': 'floop@doop.ca', 'username': 'floop' },
  { 'email': 'spang@glarn.io', 'username': 'spang' }
]

```

emails will not be sent.

so i tried modifying it based on an old working script:

```python
      alarmEmailList.append(userEmail)
alarmRoster = { 'email': [alarmEmailList] }
return [alarmRoster]

```

emails do not get sent.

so, in a fit of pique, i hardcoded the damn thing:

```python
return [{ 'email': ['floop@doop.ca', 'spang@glarn.io']}]

```

emails do not send.

can someone determine what i am missing? for all i can deduce, this builds the correct structure and returns it. several times. but it flat out does not send anything. the last one is the one that really stumped me: hardcoded = nothing. whut the 🍴?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [January 16, 2024, 6:15pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-roster-does-not-send/84336/2 "2024-01-16T18:15:50Z")

</div>

Anything in the logs ?

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [January 16, 2024, 6:24pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-roster-does-not-send/84336/3 "2024-01-16T18:24:24Z")

</div>

nothing. that's what's also got me banjaxxed. flailing in the dark... 😛

soooo, i threw out ALL my assumptions and just started commenting 💩 out. turns out, the culprit is the `currentAsset = str({displayPath})`. at this point the script is tanking. according to co-worker, this should yeild the asset's name. but i don't trust that (becuase is isn't working), so i'm trying to find out if `[.]` will work as a more accurate standin that actually _works_.

EDIT: by standin, i mean to capture the asset name that is generating the alarm.

EDIT2: i'm now trying to figure out _how_ to get the asset name... trying this: `system.tag.readBlocking('[.].name')`... keep you posted. where the heck are the docs on this kind of thing? seems something that should be in the Notification docs somewhere...

---

<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:** [January 16, 2024, 8:04pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-roster-does-not-send/84336/4 "2024-01-16T20:04:28Z")

</div>

I'm pretty confident you want `event.displayPath` (which should autocomplete...).

Curly braces would be the syntax to reference a local property _in an expression_. In scripts, you have to use dictionary style access to access _arbitrary_ properties of the event object, but the core/builtin ones are exposed as getters and attributes.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [January 16, 2024, 8:29pm UTC](https://forum.inductiveautomation.com/t/custom-alarm-roster-does-not-send/84336/5 "2024-01-16T20:29:17Z")

</div>

> [@paul-griffith](#):
>
> you want `event.displayPath`

i absolutely did and absolutely do! thank you. i went digging through the `event` docs to find that gem. it would be nice if the docs for Alarms explained the `event` portion more thoroughly OR added a link to the Event doc page. trying to debug scripts from that alarm script window is a bear..
