Hi, given a Username I want to get the on call roster it belongs, This is for send it to an alarm pipeline. It is possible to do this?
MoisesZV
a bit rough and untested but should work
rosters = system.alarm.getRosters()
member = system.user.getUser
roster=""
user=""
for key, name in rosters.iteritems():
if name == member:
roster=key
user=member
print roster,user
I tryed this:
rosters = system.alarm.getRosters()
member = "moises"
roster=""
user=""
for key, name in rosters.iteritems():
if name == member:
roster=key
user=member
print roster,user
The user moises is inside a call roster but when I press a button with this code, in the console just a blank line is added.
EDIT:
I also tryed this:
rosters = system.alarm.getRosters()
member = "moises"
for key, name in rosters.iteritems():
if name == member:
print "hola"
Nothing happen in the console, it seems is not doing the comparission name == member
[b][size=150]EDIT 2:
I tryed this and it works. Thanks for the help[/size][/b]
rosters = system.alarm.getRosters()
member = "moises"
for key, values in rosters.iteritems():
for value in values:
if value == member:
roster=key
print roster
Time to learn a bit about debugging.
In the loop, try printing out the key, name pairs you get. You’ll see how to fix the issue.
Thanks for the help.
Ah…
I think “name” is a reserved word and should not be used