Scrip debugging help

Hello,

I¹m trying to use a custom scrip that sends an outgoing email to a specified
email address when a ticket gets resolved. After much trudging through
archived emails on this list, I was able to accomplish that. But now,
sometimes when you click ³Reply² there is the following error:

Can’t call method “head” on an undefined value at
/usr/local/lib/rt3/lib/RT/Action/SendEmail.pm line 278.

What¹s more, is my coworker got that error message in a totally different
queue. (I was hoping worst case scenario I¹d only mess up my own queue¹s
workflow, but that appears to be false.) So I was hoping someone could shed
some light…

-Why does this error happen when clicking Reply?
-Why does it apply to other queues?
-Can I fix it without disabling/deleting my scrip?

Scrip pasted below, thanks for any advice.

-Tyler

Condition: on resolve
Action: user defined
Template: transaction
Stage: transaction batch

prep code:

require RT::Action::SendEmail;
use strict;
use vars qw/@ISA/;
@ISA = qw(RT::Action::SendEmail);
$self->setUpEmail();
$self->SUPER::Prepare();
$self->SUPER::Commit();

sub setUpEmail {
my $self = shift;
my $ticket = $self->TicketObj;

push @To, 'emailaddress@dns.com';
@{ $self->{'To'} }  = @To;
$self->{'Subject'}  = $ticket->OwnerObj->Name();

}

return 1;

cleanup code:

return 1;

I’m trying to use a custom scrip that sends an outgoing email to a specified email address
when a ticket gets resolved. After much trudging through archived emails on this list, I was
able to accomplish that. But now, sometimes when you click “Reply” there is the following
error:

What isn’t that just

Condition: on resolve
Action: notify other recipients
Template: custom template with a hardcoded To:

The code you’ve sent as a sample has little chance of ever working,
and it totally breaks the encapsulation of running in Preview mode,
which is how you broke Reply.

-kevin

Take a look at NotifyGroup action.On Mon, Mar 28, 2011 at 10:44 PM, Tyler Harding tharding@uoregon.edu wrote:

Hello,

I’m trying to use a custom scrip that sends an outgoing email to a specified
email address when a ticket gets resolved. After much trudging through
archived emails on this list, I was able to accomplish that. But now,
sometimes when you click “Reply” there is the following error:

Can’t call method “head” on an undefined value at
/usr/local/lib/rt3/lib/RT/Action/SendEmail.pm line 278.

What’s more, is my coworker got that error message in a totally different
queue. (I was hoping worst case scenario I’d only mess up my own queue’s
workflow, but that appears to be false.) So I was hoping someone could shed
some light…

-Why does this error happen when clicking Reply?
-Why does it apply to other queues?
-Can I fix it without disabling/deleting my scrip?

Scrip pasted below, thanks for any advice.

-Tyler

Condition: on resolve
Action: user defined
Template: transaction
Stage: transaction batch

prep code:

require RT::Action::SendEmail;
use strict;
use vars qw/@ISA/;
@ISA = qw(RT::Action::SendEmail);
$self->setUpEmail();
$self->SUPER::Prepare();
$self->SUPER::Commit();

sub setUpEmail {
my $self = shift;
my $ticket = $self->TicketObj;

push @To, 'emailaddress@dns.com';
@{ $self->{'To'} }  = @To;
$self->{'Subject'}  = $ticket->OwnerObj->Name();

}

return 1;

cleanup code:

return 1;

Best regards, Ruslan.