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

2016-05-17 Thread Jim Brandt

Hi Zoey,

Glad you were able to get it working. And thank you (and all others who 
do so) for sharing the working solution with the list. It definitely 
helps people in the future with a similar use case.


Jim

On 5/16/16 5:03 PM, Zoey Schutt wrote:

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-boun...@lists.bestpractical.com> on behalf of
Zoey Schutt <z...@braincoral.io>
*Sent:* Monday, May 16, 2016 8:36 AM
*To:* rt-users@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



-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


[rt-users] Problems with status changing scrip

2016-05-16 Thread Zoey Schutt
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