I ended up fixing the problem myself. The functioning scrip is below for anyone
that would like to use it.
Scrip Name: Set ticket to active upon customer reply
Condition: On Correspond
Action: User Defined
Template: Blank
Custom action preparation code:
return 1;
Custom action commit code:
my $Actor = $self->TransactionObj->Creator;
my $Owner = $self->TicketObj->Owner;
# Change status to "open" if status is "customer"
if( $Owner != $Actor ) {
if ($self->TicketObj->Status() eq 'customer' ) {
$self->TicketObj->SetStatus('open');
$RT::Logger->info("Customer replied to ticket awaiting reply. Status set to
open.");
return 1;
}
return undef;
}
return undef;
RT Information:
RT 4.2.12
Perl v5.14.2 built for x86_64-linux-gnu-thread-multi
Apache 2.2.22
PHP 5.5.33-1~dotdeb+7.1
MySQL Ver 14.14 Distrib 5.5.49
Zoey Schutt
Braincoral Technology, LLC
________________________________
From: rt-users <[email protected]> on behalf of Zoey
Schutt <[email protected]>
Sent: Monday, May 16, 2016 8:36 AM
To: [email protected]
Subject: [rt-users] Problems with status changing scrip
Hello,
I am working on a scrip to auto-change the status of a ticket if it is set to
"customer" status. However, I do not want the ticket to change status if the
user who is replying to the ticket is the owner. I managed to get the status
changing properly, but as soon as I try to setup the condition it no longer
works. Could someone look this over for me and tell me where I'm messing up?
Condition: On Correspond
Action: User Defined
Template: Blank
Custom action preparation code:
return 1;
Custom action commit code:
# Abort if actor is owner of ticket
return 1 unless $self->TicketObj->Owner != $actor->id;
# Change status to "open" if status is "customer"
if ($self->TicketObj->Status() eq 'customer' ) {
$self->TicketObj->SetStatus('open');
$RT::Logger->info("Customer replied to ticket awaiting reply. Status set to
open.");
return 1;
}
return undef;
RT Information:
RT 4.2.12
Perl v5.14.2 built for x86_64-linux-gnu-thread-multi
Apache 2.2.22
PHP 5.5.33-1~dotdeb+7.1
MySQL Ver 14.14 Distrib 5.5.49
Thanks,
Zoey Schutt
Braincoral Technology, LLC
---------
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016