Resolve when ticket is from a certain email address

Hi All,

I am trying to get our old RT (3.4.5) to resolve tickets when a user
replies, but am having some issues.

The basic setup is this: external user emails to the help desk email which
sends it to the helpdesk queue email and to a single customer facing user.
That user refuses to user RT, so when he replies to the email he does a
reply all (to both the customer and RT). RT is setup to merge tickets with
similar names (RE:/FW:) so his response is merged to the original ticket,
but when I attempt to get a scrip to resolve the ticket when the email is
from this user it doesn’t work as I want. Currently it will resolve the
ticket, no matter who replys, which is definitely a no-no.

I figure that the issue is my comparison of the $val to the email address.
I had this as well and it didn’t work either: /resolveuseremail@
domain.com/g

If someone could help me out I would greatly appreciate it. Below is the
scrip as it currently sits, except for the time being the resolve by user
part is commented out.

Thanks,

Kevin

my $notnagios_desc = undef;
my $same_desc = undef;
my $Transaction = $self->TransactionObj;
my $subject = $Transaction->Attachments->First->GetHeader(‘Subject’);
my $val = ($self->TicketObj->Requestors->MemberEmailAddressesAsString);

if (($subject =~ m/^RE:/i) || ( $subject =~ m/^FW:/i )) {
$notnagios_desc=substr($subject,4);
if (($notnagios_desc =~ m/^FW:/i) || ($notnagios_desc =~ m/^RE:/i )) {
$notnagios_desc=substr($notnagios_desc,4);
if (($notnagios_desc =~ m/^FW:/i) || ($notnagios_desc =~ m/^RE:/i
)) {
$notnagios_desc=substr($notnagios_desc,4);
}
}
} else {
$notnagios_desc=$subject;
}

look for same subject on existing tickets

my $search = RT::Tickets->new($RT::SystemUser);
$search->LimitQueue(VALUE => ‘HelpDesk’);
$search->LimitStatus(VALUE => ‘new’, OPERATOR => ‘=’, ENTRYAGGREGATOR =>
‘or’);
$search->LimitStatus(VALUE => ‘open’, OPERATOR => ‘=’);

if ($search->Count == 0) { return 1; }
my $id = undef;
while (my $ticket = $search->Next) {

Ignore this ticket that opened this transaction

next if $self->TicketObj->Id == $ticket->Id;
$same_desc=$ticket->Subject;
if (($same_desc =~ m/^FW:/i) || ($same_desc =~ m/^RE:/i )) {
$same_desc=substr($same_desc,4);
if (($same_desc =~ m/^FW:/i) || ($same_desc =~ m/^RE:/i )) {
$same_desc=substr($same_desc,4);
if (($same_desc =~ m/^FW:/i) || ($same_desc =~ m/^RE:/i )) {
$same_desc=substr($same_desc,4);
}
}
}

if ($notnagios_desc eq $same_desc) {
# Found the same subject
$id = $ticket->Id;
$self->TicketObj->MergeInto($id);
}
}

if ($val == ‘resolveuseremail@domain.com’) {

Set Set owner to e-mail sender, status to ‘resolved’

my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;
my $CreatorId = $Transaction->CreatorObj->Id;
$Ticket->SetOwner($CreatorId);
$Ticket->SetStatus(‘resolved’);
}

$id || return 1;
1;

Solved, instead of searching of the full email address, changed it to find
part of the user’s email address from the headers, and resolve if found.On Mon, Aug 29, 2011 at 12:28 PM, Kevin Fox root.kev@gmail.com wrote:

Hi All,

I am trying to get our old RT (3.4.5) to resolve tickets when a user
replies, but am having some issues.

The basic setup is this: external user emails to the help desk email which
sends it to the helpdesk queue email and to a single customer facing user.
That user refuses to user RT, so when he replies to the email he does a
reply all (to both the customer and RT). RT is setup to merge tickets with
similar names (RE:/FW:) so his response is merged to the original ticket,
but when I attempt to get a scrip to resolve the ticket when the email is
from this user it doesn’t work as I want. Currently it will resolve the
ticket, no matter who replys, which is definitely a no-no.

I figure that the issue is my comparison of the $val to the email address.
I had this as well and it didn’t work either: /resolveuseremail@
domain.com/g

If someone could help me out I would greatly appreciate it. Below is the
scrip as it currently sits, except for the time being the resolve by user
part is commented out.

Thanks,

Kevin

my $notnagios_desc = undef;
my $same_desc = undef;
my $Transaction = $self->TransactionObj;
my $subject = $Transaction->Attachments->First->GetHeader(‘Subject’);
my $val = ($self->TicketObj->Requestors->MemberEmailAddressesAsString);

if (($subject =~ m/^RE:/i) || ( $subject =~ m/^FW:/i )) {
$notnagios_desc=substr($subject,4);
if (($notnagios_desc =~ m/^FW:/i) || ($notnagios_desc =~ m/^RE:/i )) {
$notnagios_desc=substr($notnagios_desc,4);
if (($notnagios_desc =~ m/^FW:/i) || ($notnagios_desc =~ m/^RE:/i
)) {
$notnagios_desc=substr($notnagios_desc,4);
}
}
} else {
$notnagios_desc=$subject;
}

look for same subject on existing tickets

my $search = RT::Tickets->new($RT::SystemUser);
$search->LimitQueue(VALUE => ‘HelpDesk’);
$search->LimitStatus(VALUE => ‘new’, OPERATOR => ‘=’, ENTRYAGGREGATOR =>
‘or’);
$search->LimitStatus(VALUE => ‘open’, OPERATOR => ‘=’);

if ($search->Count == 0) { return 1; }
my $id = undef;
while (my $ticket = $search->Next) {

Ignore this ticket that opened this transaction

next if $self->TicketObj->Id == $ticket->Id;
$same_desc=$ticket->Subject;
if (($same_desc =~ m/^FW:/i) || ($same_desc =~ m/^RE:/i )) {
$same_desc=substr($same_desc,4);
if (($same_desc =~ m/^FW:/i) || ($same_desc =~ m/^RE:/i )) {
$same_desc=substr($same_desc,4);
if (($same_desc =~ m/^FW:/i) || ($same_desc =~ m/^RE:/i )) {
$same_desc=substr($same_desc,4);
}
}
}

if ($notnagios_desc eq $same_desc) {
# Found the same subject
$id = $ticket->Id;
$self->TicketObj->MergeInto($id);
}
}

if ($val == ‘resolveuseremail@domain.com’) {

Set Set owner to e-mail sender, status to ‘resolved’

my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;
my $CreatorId = $Transaction->CreatorObj->Id;
$Ticket->SetOwner($CreatorId);
$Ticket->SetStatus(‘resolved’);
}

$id || return 1;
1;