Sanity check on a scrip/custom flow

So a little background… this used to work. Then I rebuilt the system, and all I can think is that I missed a step somewhere.

I have a queue called te-accounts. Vendors/partners email it to get an automated account set up. It’s supposed to look at the domain they’re emailing from, and add the user to the appropriate group. Then it is supposed to resolve the ticket, and reply to the requestor with a custom template.

What’s actually happening is that it opens a ticket, immediately resolves the ticket, and responds with the generic resolved template. The user is never added to any groups.

I could use a sanity check on the moving parts to make sure I didn’t miss something silly.

Queue “accounts” allows “Everyone” and “Unpriviledged” to “CreateTicket”.

/etc/aliases (emails me the original request also, so I can manually intervene when it breaks)
te-accounts: accounts-queue, accounts-email
accounts-queue: "|/usr/bin/rt-mailgate --queue accounts --action correspond --url https://spdsupport.tivo.com/ --timeout 1000"
accounts-email: kmckinnis@tivo.commailto:kmckinnis@tivo.com

accounts queue scrips:
Description: Adding new users to group based on domain
Condition: On Create
Action: User Defined
Template: Global Template: Autoreply
Stage: TransactionCreate

Custom condition
Custom action preparation code: return 1;
Custom action cleanup code:

Domains we want to move

my $domains = {};

my %domain_map = (
’@..?comcast.com’ => “comcast”,
’@.
.?cox.com’ => “cox”,
’@..?tvworks.com’ => “comcast”,
’@.
.?tivo.com’ => “support”
);

#Check each of our defined domains for a match
foreach my $domainKey (keys %domain_map ){
if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {
# Domain matches - move to the right group

my $user = RT::User->new( $RT::SystemUser );
$user->LoadByEmail($self->TicketObj->RequestorAddresses);
die “couldn’t load user” unless $user->id;
my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup( $domain_map{$domainKey} );
$group->AddMember($user->id);
}
}

Description: Resolve all tickets in this queue
Condition: On create
Action: User Defined
Template: Global template: group addition
Stage: TransactionCreate
Custom condition:
Custom action preparation code: return 1;
Custom action cleanup code:
$self->TicketObj->SetStatus(‘resolved’);
return 1;

Global template for resolve account only tickets:

Your account has been given permissions to the $group queue. Please log in via the web interface at “.$RT::WebURL.” to view tickets for the $group queue.

                    Thank you.
                    {$Ticket->QueueObj->CorrespondAddress()}

{$Transaction->Content()}

So what the heck am I missing?

Kimberly McKinnis
System Operations Engineer
Service Provider Division, TiVo Inc
408-519-9607

In addition, I should point out that we’re running RT 3.4.5, and the following is the only logging for the transaction:

[Wed Sep 9 21:52:49 2009] [debug]: Converting ‘us-ascii’ to ‘utf-8’ for text/plain - Subjectless message (/usr/lib/rt/RT/I18N.pm:226)
[Wed Sep 9 21:52:49 2009] [debug]: Guessed encoding: ascii (/usr/lib/rt/RT/I18N.pm:396)
[Wed Sep 9 21:52:49 2009] [debug]: Guessed encoding: ascii (/usr/lib/rt/RT/I18N.pm:396)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16134 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16135 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16136 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16137 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16138 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to prepare scrips for transaction #16138 (/usr/lib/rt/RT/Transaction_Overlay.pm:160)
[Wed Sep 9 21:52:49 2009] [debug]: Found 7 scrips (/usr/lib/rt/RT/Scrips_Overlay.pm:356)
[Wed Sep 9 21:52:50 2009] [debug]: About to commit scrips for transaction #16138 (/usr/lib/rt/RT/Transaction_Overlay.pm:169)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-1610.579-3-0@TiVo #579/16138 - Scrip 3 (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16139 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-1610.579-3-0@TiVo sent To: kmckinnis@tivo.com Cc: Bcc: (/usr/lib/rt/RT/Action/SendEmail.pm:297)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-818.579-4-0@TiVo #579/16138 - Scrip 4 (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-818.579-4-0@TiVo No recipients found. Not sending.
(/usr/lib/rt/RT/Action/SendEmail.pm:249)
[Wed Sep 9 21:52:50 2009] [debug]: To email was: te-accounts te-accounts@tivo.com ((eval 2282):4)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16140 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [debug]: About to prepare scrips for transaction #16140 (/usr/lib/rt/RT/Transaction_Overlay.pm:160)
[Wed Sep 9 21:52:50 2009] [debug]: Found 2 scrips (/usr/lib/rt/RT/Scrips_Overlay.pm:356)
[Wed Sep 9 21:52:50 2009] [debug]: About to commit scrips for transaction #16140 (/usr/lib/rt/RT/Transaction_Overlay.pm:169)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-1012.579-10-0@TiVo #579/16140 - Scrip 10 (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16141 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-1012.579-10-0@TiVo sent To: kmckinnis@tivo.com Cc: Bcc: (/usr/lib/rt/RT/Action/SendEmail.pm:297)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-929.579-22-0@TiVo #579/16138 - Scrip 22 Notify Ccs on New Ticket (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16142 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-929.579-22-0@TiVo sent To: Cc: te-accounts@tivo.com Bcc: (/usr/lib/rt/RT/Action/SendEmail.pm:297)
[Wed Sep 9 21:52:50 2009] [info]: Ticket 579 created in queue ‘accounts’ by kmckinnis (/usr/lib/rt/RT/Ticket_Overlay.pm:730)
[Wed Sep 9 21:52:51 2009] [debug]: Found a ticket ID. It’s 579 (/usr/local/rt/lib/RT/Interface/Email.pm:483)
[Wed Sep 9 21:52:51 2009] [crit]: RT Recieved mail (rt-3.4.5-22811-1252533170-929.579-22-0@TiVo
) from itself. (/usr/local/rt/lib/RT/Interface/Email.pm:732)
[Wed Sep 9 21:52:51 2009] [crit]: RT thinks this message may be a bounce (/usr/local/rt/lib/RT/Interface/Email.pm:736)From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kimberly McKinnis
Sent: Wednesday, September 09, 2009 2:50 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] sanity check on a scrip/custom flow

So a little background… this used to work. Then I rebuilt the system, and all I can think is that I missed a step somewhere.

I have a queue called te-accounts. Vendors/partners email it to get an automated account set up. It’s supposed to look at the domain they’re emailing from, and add the user to the appropriate group. Then it is supposed to resolve the ticket, and reply to the requestor with a custom template.

What’s actually happening is that it opens a ticket, immediately resolves the ticket, and responds with the generic resolved template. The user is never added to any groups.

I could use a sanity check on the moving parts to make sure I didn’t miss something silly.

Queue “accounts” allows “Everyone” and “Unpriviledged” to “CreateTicket”.

/etc/aliases (emails me the original request also, so I can manually intervene when it breaks)
te-accounts: accounts-queue, accounts-email
accounts-queue: "|/usr/bin/rt-mailgate --queue accounts --action correspond --url https://spdsupport.tivo.com/ --timeout 1000"
accounts-email: kmckinnis@tivo.commailto:kmckinnis@tivo.com

accounts queue scrips:
Description: Adding new users to group based on domain
Condition: On Create
Action: User Defined
Template: Global Template: Autoreply
Stage: TransactionCreate

Custom condition
Custom action preparation code: return 1;
Custom action cleanup code:

Domains we want to move

my $domains = {};

my %domain_map = (
’@..?comcast.com’ => “comcast”,
’@.
.?cox.com’ => “cox”,
’@..?tvworks.com’ => “comcast”,
’@.
.?tivo.com’ => “support”
);

#Check each of our defined domains for a match
foreach my $domainKey (keys %domain_map ){
if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {
# Domain matches - move to the right group

my $user = RT::User->new( $RT::SystemUser );
$user->LoadByEmail($self->TicketObj->RequestorAddresses);
die “couldn’t load user” unless $user->id;
my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup( $domain_map{$domainKey} );
$group->AddMember($user->id);
}
}

Description: Resolve all tickets in this queue
Condition: On create
Action: User Defined
Template: Global template: group addition
Stage: TransactionCreate
Custom condition:
Custom action preparation code: return 1;
Custom action cleanup code:
$self->TicketObj->SetStatus(‘resolved’);
return 1;

Global template for resolve account only tickets:
Subject: Resolved: {$Ticket->Subject}

Your account has been given permissions to the $group queue. Please log in via the web interface at “.$RT::WebURL.” to view tickets for the $group queue.

                    Thank you.
                    {$Ticket->QueueObj->CorrespondAddress()}

{$Transaction->Content()}

So what the heck am I missing?

Kimberly McKinnis
System Operations Engineer
Service Provider Division, TiVo Inc
408-519-9607

Brilliant! I did not have that line. I lost my SiteConfig in the major crash we had. Don’t even ask why this machine only had a single HDD. Thank you!From: Lander, Scott [mailto:slander@hearstsc.com]
Sent: Wednesday, September 09, 2009 3:00 PM
To: Kimberly McKinnis
Subject: RE: sanity check on a scrip/custom flow

Did you forget to

Set($AutoCreateNonExternalUsers, 1);

in etc/RT_SiteConfig.pm, perhaps?

From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kimberly McKinnis
Sent: Wednesday, September 09, 2009 5:56 PM
To: Kimberly McKinnis; rt-users@lists.bestpractical.com
Subject: Re: [rt-users] sanity check on a scrip/custom flow
In addition, I should point out that we’re running RT 3.4.5, and the following is the only logging for the transaction:

[Wed Sep 9 21:52:49 2009] [debug]: Converting ‘us-ascii’ to ‘utf-8’ for text/plain - Subjectless message (/usr/lib/rt/RT/I18N.pm:226)
[Wed Sep 9 21:52:49 2009] [debug]: Guessed encoding: ascii (/usr/lib/rt/RT/I18N.pm:396)
[Wed Sep 9 21:52:49 2009] [debug]: Guessed encoding: ascii (/usr/lib/rt/RT/I18N.pm:396)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16134 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16135 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16136 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16137 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16138 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to prepare scrips for transaction #16138 (/usr/lib/rt/RT/Transaction_Overlay.pm:160)
[Wed Sep 9 21:52:49 2009] [debug]: Found 7 scrips (/usr/lib/rt/RT/Scrips_Overlay.pm:356)
[Wed Sep 9 21:52:50 2009] [debug]: About to commit scrips for transaction #16138 (/usr/lib/rt/RT/Transaction_Overlay.pm:169)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-1610.579-3-0@TiVo #579/16138 - Scrip 3 (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16139 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-1610.579-3-0@TiVo sent To: kmckinnis@tivo.com Cc: Bcc: (/usr/lib/rt/RT/Action/SendEmail.pm:297)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-818.579-4-0@TiVo #579/16138 - Scrip 4 (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-818.579-4-0@TiVo No recipients found. Not sending.
(/usr/lib/rt/RT/Action/SendEmail.pm:249)
[Wed Sep 9 21:52:50 2009] [debug]: To email was: te-accounts te-accounts@tivo.com ((eval 2282):4)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16140 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [debug]: About to prepare scrips for transaction #16140 (/usr/lib/rt/RT/Transaction_Overlay.pm:160)
[Wed Sep 9 21:52:50 2009] [debug]: Found 2 scrips (/usr/lib/rt/RT/Scrips_Overlay.pm:356)
[Wed Sep 9 21:52:50 2009] [debug]: About to commit scrips for transaction #16140 (/usr/lib/rt/RT/Transaction_Overlay.pm:169)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-1012.579-10-0@TiVo #579/16140 - Scrip 10 (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16141 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-1012.579-10-0@TiVo sent To: kmckinnis@tivo.com Cc: Bcc: (/usr/lib/rt/RT/Action/SendEmail.pm:297)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-929.579-22-0@TiVo #579/16138 - Scrip 22 Notify Ccs on New Ticket (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16142 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-929.579-22-0@TiVo sent To: Cc: te-accounts@tivo.com Bcc: (/usr/lib/rt/RT/Action/SendEmail.pm:297)
[Wed Sep 9 21:52:50 2009] [info]: Ticket 579 created in queue ‘accounts’ by kmckinnis (/usr/lib/rt/RT/Ticket_Overlay.pm:730)
[Wed Sep 9 21:52:51 2009] [debug]: Found a ticket ID. It’s 579 (/usr/local/rt/lib/RT/Interface/Email.pm:483)
[Wed Sep 9 21:52:51 2009] [crit]: RT Recieved mail (rt-3.4.5-22811-1252533170-929.579-22-0@TiVo
) from itself. (/usr/local/rt/lib/RT/Interface/Email.pm:732)
[Wed Sep 9 21:52:51 2009] [crit]: RT thinks this message may be a bounce (/usr/local/rt/lib/RT/Interface/Email.pm:736)

From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kimberly McKinnis
Sent: Wednesday, September 09, 2009 2:50 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] sanity check on a scrip/custom flow

So a little background… this used to work. Then I rebuilt the system, and all I can think is that I missed a step somewhere.

I have a queue called te-accounts. Vendors/partners email it to get an automated account set up. It’s supposed to look at the domain they’re emailing from, and add the user to the appropriate group. Then it is supposed to resolve the ticket, and reply to the requestor with a custom template.

What’s actually happening is that it opens a ticket, immediately resolves the ticket, and responds with the generic resolved template. The user is never added to any groups.

I could use a sanity check on the moving parts to make sure I didn’t miss something silly.

Queue “accounts” allows “Everyone” and “Unpriviledged” to “CreateTicket”.

/etc/aliases (emails me the original request also, so I can manually intervene when it breaks)
te-accounts: accounts-queue, accounts-email
accounts-queue: "|/usr/bin/rt-mailgate --queue accounts --action correspond --url https://spdsupport.tivo.com/ --timeout 1000"
accounts-email: kmckinnis@tivo.commailto:kmckinnis@tivo.com

accounts queue scrips:
Description: Adding new users to group based on domain
Condition: On Create
Action: User Defined
Template: Global Template: Autoreply
Stage: TransactionCreate

Custom condition
Custom action preparation code: return 1;
Custom action cleanup code:

Domains we want to move

my $domains = {};

my %domain_map = (
’@..?comcast.com’ => “comcast”,
’@.
.?cox.com’ => “cox”,
’@..?tvworks.com’ => “comcast”,
’@.
.?tivo.com’ => “support”
);

#Check each of our defined domains for a match
foreach my $domainKey (keys %domain_map ){
if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {
# Domain matches - move to the right group

my $user = RT::User->new( $RT::SystemUser );
$user->LoadByEmail($self->TicketObj->RequestorAddresses);
die “couldn’t load user” unless $user->id;
my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup( $domain_map{$domainKey} );
$group->AddMember($user->id);
}
}

Description: Resolve all tickets in this queue
Condition: On create
Action: User Defined
Template: Global template: group addition
Stage: TransactionCreate
Custom condition:
Custom action preparation code: return 1;
Custom action cleanup code:
$self->TicketObj->SetStatus(‘resolved’);
return 1;

Global template for resolve account only tickets:
Subject: Resolved: {$Ticket->Subject}

Your account has been given permissions to the $group queue. Please log in via the web interface at “.$RT::WebURL.” to view tickets for the $group queue.

                    Thank you.
                    {$Ticket->QueueObj->CorrespondAddress()}

{$Transaction->Content()}

So what the heck am I missing?

Kimberly McKinnis
System Operations Engineer
Service Provider Division, TiVo Inc
408-519-9607

This e-mail message is intended only for the personal use of the recipient(s) named above. If you are not an intended recipient, you may not review, copy or distribute this message. If you have received this communication in error, please notify the Hearst Service Center (cadmin@hearstsc.com) immediately by email and delete the original message.

Unfortunately, it’s still not sending the custom template as a reply after it resolves the ticket.

Is this correct? I don’t remember having a separate scrip to send the template separately from resolving.

Description: Resolve all tickets in this queue
Condition: On create
Action: User Defined
Template: Global template: group addition
Stage: TransactionCreate
Custom condition:
Custom action preparation code: return 1;
Custom action cleanup code:
$self->TicketObj->SetStatus(‘resolved’);
return 1;From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kimberly McKinnis
Sent: Wednesday, September 09, 2009 3:09 PM
To: Lander, Scott; rt-users@lists.bestpractical.com
Subject: Re: [rt-users] sanity check on a scrip/custom flow

Brilliant! I did not have that line. I lost my SiteConfig in the major crash we had. Don’t even ask why this machine only had a single HDD. Thank you!

From: Lander, Scott [mailto:slander@hearstsc.com]
Sent: Wednesday, September 09, 2009 3:00 PM
To: Kimberly McKinnis
Subject: RE: sanity check on a scrip/custom flow

Did you forget to

Set($AutoCreateNonExternalUsers, 1);

in etc/RT_SiteConfig.pm, perhaps?

From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kimberly McKinnis
Sent: Wednesday, September 09, 2009 5:56 PM
To: Kimberly McKinnis; rt-users@lists.bestpractical.com
Subject: Re: [rt-users] sanity check on a scrip/custom flow
In addition, I should point out that we’re running RT 3.4.5, and the following is the only logging for the transaction:

[Wed Sep 9 21:52:49 2009] [debug]: Converting ‘us-ascii’ to ‘utf-8’ for text/plain - Subjectless message (/usr/lib/rt/RT/I18N.pm:226)
[Wed Sep 9 21:52:49 2009] [debug]: Guessed encoding: ascii (/usr/lib/rt/RT/I18N.pm:396)
[Wed Sep 9 21:52:49 2009] [debug]: Guessed encoding: ascii (/usr/lib/rt/RT/I18N.pm:396)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16134 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16135 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16136 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16137 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to think about scrips for transaction #16138 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:49 2009] [debug]: About to prepare scrips for transaction #16138 (/usr/lib/rt/RT/Transaction_Overlay.pm:160)
[Wed Sep 9 21:52:49 2009] [debug]: Found 7 scrips (/usr/lib/rt/RT/Scrips_Overlay.pm:356)
[Wed Sep 9 21:52:50 2009] [debug]: About to commit scrips for transaction #16138 (/usr/lib/rt/RT/Transaction_Overlay.pm:169)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-1610.579-3-0@TiVo #579/16138 - Scrip 3 (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16139 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-1610.579-3-0@TiVo sent To: kmckinnis@tivo.com Cc: Bcc: (/usr/lib/rt/RT/Action/SendEmail.pm:297)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-818.579-4-0@TiVo #579/16138 - Scrip 4 (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533169-818.579-4-0@TiVo No recipients found. Not sending.
(/usr/lib/rt/RT/Action/SendEmail.pm:249)
[Wed Sep 9 21:52:50 2009] [debug]: To email was: te-accounts te-accounts@tivo.com ((eval 2282):4)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16140 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [debug]: About to prepare scrips for transaction #16140 (/usr/lib/rt/RT/Transaction_Overlay.pm:160)
[Wed Sep 9 21:52:50 2009] [debug]: Found 2 scrips (/usr/lib/rt/RT/Scrips_Overlay.pm:356)
[Wed Sep 9 21:52:50 2009] [debug]: About to commit scrips for transaction #16140 (/usr/lib/rt/RT/Transaction_Overlay.pm:169)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-1012.579-10-0@TiVo #579/16140 - Scrip 10 (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16141 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-1012.579-10-0@TiVo sent To: kmckinnis@tivo.com Cc: Bcc: (/usr/lib/rt/RT/Action/SendEmail.pm:297)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-929.579-22-0@TiVo #579/16138 - Scrip 22 Notify Ccs on New Ticket (/usr/lib/rt/RT/Action/SendEmail.pm:237)
[Wed Sep 9 21:52:50 2009] [debug]: About to think about scrips for transaction #16142 (/usr/lib/rt/RT/Transaction_Overlay.pm:156)
[Wed Sep 9 21:52:50 2009] [info]: rt-3.4.5-22811-1252533170-929.579-22-0@TiVo sent To: Cc: te-accounts@tivo.com Bcc: (/usr/lib/rt/RT/Action/SendEmail.pm:297)
[Wed Sep 9 21:52:50 2009] [info]: Ticket 579 created in queue ‘accounts’ by kmckinnis (/usr/lib/rt/RT/Ticket_Overlay.pm:730)
[Wed Sep 9 21:52:51 2009] [debug]: Found a ticket ID. It’s 579 (/usr/local/rt/lib/RT/Interface/Email.pm:483)
[Wed Sep 9 21:52:51 2009] [crit]: RT Recieved mail (rt-3.4.5-22811-1252533170-929.579-22-0@TiVo
) from itself. (/usr/local/rt/lib/RT/Interface/Email.pm:732)
[Wed Sep 9 21:52:51 2009] [crit]: RT thinks this message may be a bounce (/usr/local/rt/lib/RT/Interface/Email.pm:736)

From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kimberly McKinnis
Sent: Wednesday, September 09, 2009 2:50 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] sanity check on a scrip/custom flow

So a little background… this used to work. Then I rebuilt the system, and all I can think is that I missed a step somewhere.

I have a queue called te-accounts. Vendors/partners email it to get an automated account set up. It’s supposed to look at the domain they’re emailing from, and add the user to the appropriate group. Then it is supposed to resolve the ticket, and reply to the requestor with a custom template.

What’s actually happening is that it opens a ticket, immediately resolves the ticket, and responds with the generic resolved template. The user is never added to any groups.

I could use a sanity check on the moving parts to make sure I didn’t miss something silly.

Queue “accounts” allows “Everyone” and “Unpriviledged” to “CreateTicket”.

/etc/aliases (emails me the original request also, so I can manually intervene when it breaks)
te-accounts: accounts-queue, accounts-email
accounts-queue: "|/usr/bin/rt-mailgate --queue accounts --action correspond --url https://spdsupport.tivo.com/ --timeout 1000"
accounts-email: kmckinnis@tivo.commailto:kmckinnis@tivo.com

accounts queue scrips:
Description: Adding new users to group based on domain
Condition: On Create
Action: User Defined
Template: Global Template: Autoreply
Stage: TransactionCreate

Custom condition
Custom action preparation code: return 1;
Custom action cleanup code:

Domains we want to move

my $domains = {};

my %domain_map = (
’@..?comcast.com’ => “comcast”,
’@.
.?cox.com’ => “cox”,
’@..?tvworks.com’ => “comcast”,
’@.
.?tivo.com’ => “support”
);

#Check each of our defined domains for a match
foreach my $domainKey (keys %domain_map ){
if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {
# Domain matches - move to the right group

my $user = RT::User->new( $RT::SystemUser );
$user->LoadByEmail($self->TicketObj->RequestorAddresses);
die “couldn’t load user” unless $user->id;
my $group = RT::Group->new( $RT::SystemUser );
$group->LoadUserDefinedGroup( $domain_map{$domainKey} );
$group->AddMember($user->id);
}
}

Description: Resolve all tickets in this queue
Condition: On create
Action: User Defined
Template: Global template: group addition
Stage: TransactionCreate
Custom condition:
Custom action preparation code: return 1;
Custom action cleanup code:
$self->TicketObj->SetStatus(‘resolved’);
return 1;

Global template for resolve account only tickets:
Subject: Resolved: {$Ticket->Subject}

Your account has been given permissions to the $group queue. Please log in via the web interface at “.$RT::WebURL.” to view tickets for the $group queue.

                    Thank you.
                    {$Ticket->QueueObj->CorrespondAddress()}

{$Transaction->Content()}

So what the heck am I missing?

Kimberly McKinnis
System Operations Engineer
Service Provider Division, TiVo Inc
408-519-9607

This e-mail message is intended only for the personal use of the recipient(s) named above. If you are not an intended recipient, you may not review, copy or distribute this message. If you have received this communication in error, please notify the Hearst Service Center (cadmin@hearstsc.com) immediately by email and delete the original message.