Seeking notification method advice

Hi everyone,

Our RT system is used throughout our school district which includes eight different schools. Each school has its own technician who handles the vast majority of tech support requests at that school. All of our RT tickets feed into a central queue called “Incidents,” a design decision that allows our techs to help one another by dipping into the Incidents queue to grab tickets when they have time.

I just finished a scrip action that sets a custom field for each ticket in the Incidents queue based on the result of an LDAP query. For example, if a teacher from our high school submits a ticket, a ticket custom field called “Building” gets set to “BHS”.

Now here’s the issue: I’d like to notify the technician at a particular school when someone from that school submits a ticket. I don’t want to set the tech as the ticket owner because it’s possible that another tech will actually grab it. And I don’t want to overwhelm all the techs by notifying them of every incoming ticket.

What’s the best approach?

Would it help to create a user custom field and set that to the building too?

Could I use the SendEmailAction for this and create a version of the template for each of the techs? http://wiki.bestpractical.com/view/SendEmailAction

I’d love to hear what some of you think.

-Tim

Tim Wilson, Director of Technology
Buffalo-Hanover-Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us

Hi Tim,

The number of schools is small enough that I’d do it this way:

  1. Create a group with the same name as each school (BHS in this
    case). The members of the group are the respective techs. This lets you
    scale to multiple techs at a single location or have a single tech cover
    multiple locations.
  2. When you get the info from your LDAP query (BHS), use it to get the
    e-mail address of each member of the BHS group, then send your notification
    to the resulting e-mail list.
  3. As techs come and go, just update the group membership.

Have fun!
Gene

At 08:04 PM 8/21/2007, Tim Wilson wrote:

Hi everyone,

Our RT system is used throughout our school district which includes eight
different schools. Each school has its own technician who handles the vast
majority of tech support requests at that school. All of our RT tickets
feed into a central queue called “Incidents,” a design decision that
allows our techs to help one another by dipping into the Incidents queue
to grab tickets when they have time.

I just finished a scrip action that sets a custom field for each ticket in
the Incidents queue based on the result of an LDAP query. For example, if
a teacher from our high school submits a ticket, a ticket custom field
called “Building” gets set to “BHS”.

Now here’s the issue: I’d like to notify the technician at a particular
school when someone from that school submits a ticket. I don’t want to set
the tech as the ticket owner because it’s possible that another tech will
actually grab it. And I don’t want to overwhelm all the techs by notifying
them of every incoming ticket.

What’s the best approach?

Would it help to create a user custom field and set that to the building too?

Could I use the SendEmailAction for this and create a version of the
template for each of the techs?
http://wiki.bestpractical.com/view/SendEmailAction

I’d love to hear what some of you think.

-Tim


Tim Wilson, Director of Technology
Buffalo-Hanover-Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Gene LeDuc, GSEC
Security Analyst
San Diego State University

Everyone,

This looks like a useful and flexible approach. I already have an “On Create” scrip that inspects the requestor and sets the “Building” custom field from the user’s LDAP record. Now it seems to me that the best approach going forward is to create a scrip that triggers whenever that custom field gets changed. That should fire off after the original On Create scrip runs and anytime the field is changed subsequently, right? (I can imagine a situation where the Building CF would be set incorrectly requiring some manual intervention. Tying the scrip to that CF value changing would be useful in that situation.)

For the Condition, I’ll use the custom one referenced in the wiki here:
http://wiki.bestpractical.com/view/OnCustomFieldValueChange

The template seems straightforward too.

That leaves me with a question about the scrip action. To make it as generalizable as possible, wouldn’t I want to create an Action as a perl module (let’s call it “Notify Building Tech Team”) that grabs the newly changed “Building” custom field value and then pulls the list of techs from the corresponding group? This shouldn’t require a custom action for each different building right?

Next question: Who can build this for me? It’s well outside my perl comfort zone, and I’ll pay the going rate. Send me a private email if you’re interested.

Thanks.

-Tim>>> On Wed, Aug 22, 2007 at 10:33 AM, in message 6.2.1.2.2.20070822082810.02570978@mail.sdsu.edu, Gene LeDuc gleduc@mail.sdsu.edu wrote:

Hi Tim,

The number of schools is small enough that I’d do it this way:

  1. Create a group with the same name as each school (BHS in this
    case). The members of the group are the respective techs. This lets you
    scale to multiple techs at a single location or have a single tech cover
    multiple locations.
  2. When you get the info from your LDAP query (BHS), use it to get the
    e- mail address of each member of the BHS group, then send your notification
    to the resulting e- mail list.
  3. As techs come and go, just update the group membership.

Have fun!
Gene

At 08:04 PM 8/21/2007, Tim Wilson wrote:

Hi everyone,

Our RT system is used throughout our school district which includes eight
different schools. Each school has its own technician who handles the vast
majority of tech support requests at that school. All of our RT tickets
feed into a central queue called “Incidents,” a design decision that
allows our techs to help one another by dipping into the Incidents queue
to grab tickets when they have time.

I just finished a scrip action that sets a custom field for each ticket in
the Incidents queue based on the result of an LDAP query. For example, if
a teacher from our high school submits a ticket, a ticket custom field
called “Building” gets set to “BHS”.

Now here’s the issue: I’d like to notify the technician at a particular
school when someone from that school submits a ticket. I don’t want to set
the tech as the ticket owner because it’s possible that another tech will
actually grab it. And I don’t want to overwhelm all the techs by notifying
them of every incoming ticket.

What’s the best approach?

Would it help to create a user custom field and set that to the building too?

Could I use the SendEmailAction for this and create a version of the
template for each of the techs?
http://wiki.bestpractical.com/view/SendEmailAction

I’d love to hear what some of you think.

  • Tim


Tim Wilson, Director of Technology
Buffalo- Hanover- Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us


http://lists.bestpractical.com/cgi- bin/mailman/listinfo/rt- users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Tim Wilson, Director of Technology
Buffalo-Hanover-Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us

Tim,

  You can create your own template for the scrip to use and in that 

template have some code to do whatever you want. Ghas has given me some
code that does this.

Kenn
LBNL

Tim Wilson wrote:

Hi Tim,

I’m not volunteering to build a custom module, but I don’t think you need
one. I’m pretty sure you can do what you want simply with a User Defined
condition that traps the custom field change and NotifyOtherRecipients as
the action. You make a custom template that has your basic boilerplate in
it and do a little bit of coding to get the contents of the custom field
and then the members of that group and then the e-mail addresses of the
group’s members.

Your scrip condition would be something like:
return $self->TransactionObj->Type eq ‘CustomField’ &&
$self->TransactionObj->Field eq ‘Building’;

In your template you get the value of the field with:
my $bldg = $Ticket->FirstCustomFieldValue(‘Building’);

I haven’t written anything to enumerate members of a group, but it’s
probably pretty straightforward. After you get the group members, you
cycle through them using something like:
my $addresslist = “”;
while ( my $user = $Group->Next ) {
$addresslist .= ", " if $addresslist;
$addresslist .= $user->EmailAddress;
}

Then you do the e-mail:
$OUT = "From: $from_address

Boilerpalte text goes here.
";

Regards,
Gene

At 02:09 PM 8/22/2007, Tim Wilson wrote:

Everyone,

This looks like a useful and flexible approach. I already have an “On
Create” scrip that inspects the requestor and sets the “Building” custom
field from the user’s LDAP record. Now it seems to me that the best
approach going forward is to create a scrip that triggers whenever that
custom field gets changed. That should fire off after the original On
Create scrip runs and anytime the field is changed subsequently, right? (I
can imagine a situation where the Building CF would be set incorrectly
requiring some manual intervention. Tying the scrip to that CF value
changing would be useful in that situation.)

For the Condition, I’ll use the custom one referenced in the wiki here:
http://wiki.bestpractical.com/view/OnCustomFieldValueChange

The template seems straightforward too.

That leaves me with a question about the scrip action. To make it as
generalizable as possible, wouldn’t I want to create an Action as a perl
module (let’s call it “Notify Building Tech Team”) that grabs the newly
changed “Building” custom field value and then pulls the list of techs
from the corresponding group? This shouldn’t require a custom action for
each different building right?

Next question: Who can build this for me? It’s well outside my perl
comfort zone, and I’ll pay the going rate. Send me a private email if
you’re interested.

Thanks.

-Tim

Hi Tim,

The number of schools is small enough that I’d do it this way:

  1. Create a group with the same name as each school (BHS in this
    case). The members of the group are the respective techs. This lets you
    scale to multiple techs at a single location or have a single tech cover
    multiple locations.
  2. When you get the info from your LDAP query (BHS), use it to get the
    e- mail address of each member of the BHS group, then send your
    notification
    to the resulting e- mail list.
  3. As techs come and go, just update the group membership.

Have fun!
Gene

At 08:04 PM 8/21/2007, Tim Wilson wrote:

Hi everyone,

Our RT system is used throughout our school district which includes eight
different schools. Each school has its own technician who handles the vast
majority of tech support requests at that school. All of our RT tickets
feed into a central queue called “Incidents,” a design decision that
allows our techs to help one another by dipping into the Incidents queue
to grab tickets when they have time.

I just finished a scrip action that sets a custom field for each ticket in
the Incidents queue based on the result of an LDAP query. For example, if
a teacher from our high school submits a ticket, a ticket custom field
called “Building” gets set to “BHS”.

Now here’s the issue: I’d like to notify the technician at a particular
school when someone from that school submits a ticket. I don’t want to set
the tech as the ticket owner because it’s possible that another tech will
actually grab it. And I don’t want to overwhelm all the techs by notifying
them of every incoming ticket.

What’s the best approach?

Would it help to create a user custom field and set that to the
building too?

Could I use the SendEmailAction for this and create a version of the
template for each of the techs?
http://wiki.bestpractical.com/view/SendEmailAction

I’d love to hear what some of you think.

  • Tim


Tim Wilson, Director of Technology
Buffalo- Hanover- Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us


http://lists.bestpractical.com/cgi- bin/mailman/listinfo/rt- users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


Tim Wilson, Director of Technology
Buffalo-Hanover-Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us

Gene LeDuc, GSEC
Security Analyst
San Diego State University

Replying to my own e-mail…

Hah! Found an easy way in the wiki to get the addresses of the group
members into your template.

my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup($bldg);
my $addresslist = $group->MemberEmailAddressesAsString;

Put the pieces from my previous post together with the above snippet and
you should have a scrip and template that will do what you want.

Regards,
Gene

At 02:40 PM 8/22/2007, Gene LeDuc wrote:

Hi Tim,

I’m not volunteering to build a custom module, but I don’t think you need
one. I’m pretty sure you can do what you want simply with a User Defined
condition that traps the custom field change and NotifyOtherRecipients as
the action. You make a custom template that has your basic boilerplate in
it and do a little bit of coding to get the contents of the custom field
and then the members of that group and then the e-mail addresses of the
group’s members.

Your scrip condition would be something like:
return $self->TransactionObj->Type eq ‘CustomField’ &&
$self->TransactionObj->Field eq ‘Building’;

In your template you get the value of the field with:
my $bldg = $Ticket->FirstCustomFieldValue(‘Building’);

I haven’t written anything to enumerate members of a group, but it’s
probably pretty straightforward. After you get the group members, you
cycle through them using something like:
my $addresslist = “”;
while ( my $user = $Group->Next ) {
$addresslist .= ", " if $addresslist;
$addresslist .= $user->EmailAddress;
}

Then you do the e-mail:
$OUT = "From: $from_address
To: $addresslist
Subject: $subject

Boilerpalte text goes here.
";

Regards,
Gene

At 02:09 PM 8/22/2007, Tim Wilson wrote:

Everyone,

This looks like a useful and flexible approach. I already have an “On
Create” scrip that inspects the requestor and sets the “Building” custom
field from the user’s LDAP record. Now it seems to me that the best
approach going forward is to create a scrip that triggers whenever that
custom field gets changed. That should fire off after the original On
Create scrip runs and anytime the field is changed subsequently, right?
(I can imagine a situation where the Building CF would be set incorrectly
requiring some manual intervention. Tying the scrip to that CF value
changing would be useful in that situation.)

For the Condition, I’ll use the custom one referenced in the wiki here:
http://wiki.bestpractical.com/view/OnCustomFieldValueChange

The template seems straightforward too.

That leaves me with a question about the scrip action. To make it as
generalizable as possible, wouldn’t I want to create an Action as a perl
module (let’s call it “Notify Building Tech Team”) that grabs the newly
changed “Building” custom field value and then pulls the list of techs
from the corresponding group? This shouldn’t require a custom action for
each different building right?

Next question: Who can build this for me? It’s well outside my perl
comfort zone, and I’ll pay the going rate. Send me a private email if
you’re interested.

Thanks.

-Tim

Hi Tim,

The number of schools is small enough that I’d do it this way:

  1. Create a group with the same name as each school (BHS in this
    case). The members of the group are the respective techs. This lets you
    scale to multiple techs at a single location or have a single tech cover
    multiple locations.
  2. When you get the info from your LDAP query (BHS), use it to get the
    e- mail address of each member of the BHS group, then send your
    notification
    to the resulting e- mail list.
  3. As techs come and go, just update the group membership.

Have fun!
Gene

At 08:04 PM 8/21/2007, Tim Wilson wrote:

Hi everyone,

Our RT system is used throughout our school district which includes eight
different schools. Each school has its own technician who handles the vast
majority of tech support requests at that school. All of our RT tickets
feed into a central queue called “Incidents,” a design decision that
allows our techs to help one another by dipping into the Incidents queue
to grab tickets when they have time.

I just finished a scrip action that sets a custom field for each ticket in
the Incidents queue based on the result of an LDAP query. For example, if
a teacher from our high school submits a ticket, a ticket custom field
called “Building” gets set to “BHS”.

Now here’s the issue: I’d like to notify the technician at a particular
school when someone from that school submits a ticket. I don’t want to set
the tech as the ticket owner because it’s possible that another tech will
actually grab it. And I don’t want to overwhelm all the techs by notifying
them of every incoming ticket.

What’s the best approach?

Would it help to create a user custom field and set that to the
building too?

Could I use the SendEmailAction for this and create a version of the
template for each of the techs?
http://wiki.bestpractical.com/view/SendEmailAction

I’d love to hear what some of you think.

  • Tim


Tim Wilson, Director of Technology
Buffalo- Hanover- Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us


http://lists.bestpractical.com/cgi- bin/mailman/listinfo/rt- users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


Tim Wilson, Director of Technology
Buffalo-Hanover-Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us


Gene LeDuc, GSEC
Security Analyst
San Diego State University


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media. Buy a
copy at http://rtbook.bestpractical.com

Gene LeDuc, GSEC
Security Analyst
San Diego State University

If you where careful about how you name your custom field values and
group names, you could just add a Bcc line in the default autoresponce
template. Then you wouldn’t even need a scrip…and really you’ll
probably have to have the names all be the same anyhow so this would be
a really simple way of doing it.

Bcc: { my $bldg = $self->TicketObj->FirstCustomFieldValue(‘building’);
my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup($bldg);
$addresslist = $group->MemberEmailAddressesAsString; }

disclaimer: I just looked at the above code, it might require some
sanity checks…

.r’

Gene LeDuc wrote:

In your template you get the value of the field with:
my $bldg = $Ticket- >FirstCustomFieldValue(‘Building’);

Then you do the e- mail:
$OUT = "From: $from_address
To: $addresslist
Subject: $subject

Boilerpalte text goes here.
";

Gene,

Is there something magic about $from_address and $subject or do I need to create those variables? I’m assuming that I can’t use the built-in RT templates for those since I’m adding all this perl to the template.

My template now looks like this:

my $bldg = $Ticket->FirstCustomFieldValue(‘Building’);
my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup(“SupportTeam-$group”);
my $addresslist = $group->MemberEmailAddressesAsString;

$OUT = "From: $from_address

This is a test message.
";

This isn’t working, and I get the following error in the RT log:

Aug 22 22:37:43 support RT: error: couldn’t parse head; error near: my $bldg
= $Ticket->FirstCustomFieldValue(‘Building’); my $group = RT::Group->new( $RT::S
ystemUser ); $group->LoadUserDefinedGroup(“SupportTeam-$group”); my $addresslist
= $group->MemberEmailAddressesAsString; (/usr/local/rt3/lib/RT/Template_Overlay
.pm:336)

So obviously the message isn’t being generated correctly. I’ve been scouring the wiki looking for other template examples that use this sort of method, but I’m not having much luck making sense of them. Any help would be greatly appreciated.

-Tim

Tim Wilson, Director of Technology
Buffalo-Hanover-Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us

Hi Tim,

You know, I’m not sure whether RT will automatically assign a From: and
cleverness, so it wouldn’t surprise me at all if it uses the default queue
address and the ticket subject if you don’t supply them. Try leaving off
the From: and Subject: lines and see what happens.

Otherwise, you’d want something like this:
my $from_address = ‘rt@myorg.org’;
my $subject = $Ticket->Transactions->First->Subject;

And yes, you need to make a new template for this. Make sure you don’t
have any blank lines at the top of the template.

So, putting it all together (more or less), your template would consist of
everything between the ===== lines below
{ ### Template for notifying campus techs
my $bldg = $Ticket->FirstCustomFieldValue(‘Building’);
my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup(“SupportTeam-$group”);
my $addresslist = $group->MemberEmailAddressesAsString;
$OUT = "To: addresslist

Boilerplate text goes here.

Have a nice day,
The RT ticketing system
";
}

Robert Long added to this thread with a suggestion that might make your
template even simpler. He’s put all of the perl code right after To: and
then the rest of the template is just static text. Using his suggestion,
your template would look like the stuff between the ===== lines below
my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup(“SupportTeam-$bldg”);
$group->MemberEmailAddressesAsString;}

Boilerplate text goes here.

Have a nice day,
The RT ticketing system

I prefer building the entire message inside my { perl code } like the first
template because I usually put dynamic stuff inside the message body and
it’s easier for me to follow what I’m doing if I know that the only thing
that is going to be sent is in $OUT. But that’s just the way my mind works.

Gene

At 08:45 PM 8/22/2007, Tim Wilson wrote:> >>> On Wed, Aug 22, 2007 at 4:40 PM, in message 6.2.1.2.2.20070822141126.025eacc8@mail.sdsu.edu, Gene LeDuc gleduc@mail.sdsu.edu wrote:

In your template you get the value of the field with:
my $bldg = $Ticket- >FirstCustomFieldValue(‘Building’);

Then you do the e- mail:
$OUT = "From: $from_address
To: $addresslist
Subject: $subject

Boilerpalte text goes here.
";

Gene,

Is there something magic about $from_address and $subject or do I need to
create those variables? I’m assuming that I can’t use the built-in RT
templates for those since I’m adding all this perl to the template.

My template now looks like this:

my $bldg = $Ticket->FirstCustomFieldValue(‘Building’);
my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup(“SupportTeam-$group”);
my $addresslist = $group->MemberEmailAddressesAsString;

$OUT = "From: $from_address
To: $addresslist
Subject: $subject

This is a test message.
";

This isn’t working, and I get the following error in the RT log:

Aug 22 22:37:43 support RT: error: couldn’t parse head; error near: my
$bldg
= $Ticket->FirstCustomFieldValue(‘Building’); my $group = RT::Group->new(
$RT::S
ystemUser ); $group->LoadUserDefinedGroup(“SupportTeam-$group”); my
$addresslist
= $group->MemberEmailAddressesAsString;
(/usr/local/rt3/lib/RT/Template_Overlay
.pm:336)

So obviously the message isn’t being generated correctly. I’ve been
scouring the wiki looking for other template examples that use this sort
of method, but I’m not having much luck making sense of them. Any help
would be greatly appreciated.

-Tim


Tim Wilson, Director of Technology
Buffalo-Hanover-Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us

Gene LeDuc, GSEC
Security Analyst
San Diego State University