[rt-users] Re: Problems with status changing scrip

Zoey Schutt zoey at braincoral.io
Mon May 16 17:03:38 EDT 2016


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 <rt-users-bounces at lists.bestpractical.com> on behalf of Zoey Schutt <zoey at braincoral.io>
Sent: Monday, May 16, 2016 8:36 AM
To: rt-users at lists.bestpractical.com
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20160516/8a1bd2cb/attachment.htm>


More information about the rt-users mailing list