Scrip problem (status change)

Since upgrading (3.8.2 -> 4.0.6) I’ve noticed that my scrip’s aren’t
changing status unless perhaps the requester is the one replying.

Condition: On Correspond
Action: UserDefined
Template: Global:Blank
Stage: TransactionCreate

Custom condition:
Custom action preparation code: return 1;
Custom action cleanup code:
my $ticketStatus = $self->TicketObj->Status;

if ( $ticketStatus eq ‘reply-pls’ )
{
if ($self->TransactionObj->IsInbound())
{
$self->TicketObj->SetStatus( ‘new’ );
return 1;
}
}

return undef;

Can you point out the error of my ways…?

Cheers,
Kristian

Since upgrading (3.8.2 → 4.0.6) I’ve noticed that my scrip’s aren’t
changing status unless perhaps the requester is the one replying.

Condition: On Correspond
Action: UserDefined
Template: Global:Blank
Stage: TransactionCreate

Custom condition:
Custom action preparation code: return 1;
Custom action cleanup code:
my $ticketStatus = $self->TicketObj->Status;

if ( $ticketStatus eq ‘reply-pls’ )
{
if ($self->TransactionObj->IsInbound())
{
$self->TicketObj->SetStatus( ‘new’ );
return 1;
}
}

return undef;

Can you point out the error of my ways…?

You don’t check result of SetStatus. Message it returns probably tells
you that such status change is prohibited by Lifecycles configuration.

Cheers,
Kristian


Final RT training for 2012 in Atlanta, GA - October 23 & 24
http://bestpractical.com/training

We’re hiring! Careers — Best Practical Solutions

Best regards, Ruslan.

You don’t check result of SetStatus. Message it returns probably tells
you that such status change is prohibited by Lifecycles configuration.

my $ticketStatus = $self->TicketObj->Status;

if ( $ticketStatus eq ‘testing’ )
{
if ($self->TransactionObj->IsInbound())
{
my ($val, $msg) = $self->TicketObj->SetStatus( ‘new’ );
unless ( $val ) {
$RT::Logger->error( "This is an error msg: ". $msg );
return 0;
}
return 1;
}
}

return undef;

I’ve added the above lines (my perl isn’t great - i took the code from
AutoOpen.pm) but no mention of it in the logs (and I’ve also turned
debug on). I’m a superuser and it doesn’t work when I reply… unless
I’m also the requester - in which case it does work. If it works when
I’m the requester does that not discount it being a LifeCycle issue?

The only mention is:
[Sat Oct 6 07:20:38 2012] [debug]: Committing scrip #129 on txn
#3256980 of ticket #206853
(/disk1/web/vhost/rt-406/html/rt/sbin/…/lib/RT/Scrips.pm:192)

-Kristian

You don’t check result of SetStatus. Message it returns probably tells
you that such status change is prohibited by Lifecycles configuration.

my $ticketStatus = $self->TicketObj->Status;

if ( $ticketStatus eq ‘testing’ )
{
if ($self->TransactionObj->IsInbound())
{
my ($val, $msg) = $self->TicketObj->SetStatus( ‘new’ );
unless ( $val ) {
$RT::Logger->error( "This is an error msg: ". $msg );
return 0;
}
return 1;
}
}

return undef;

I’ve added the above lines (my perl isn’t great - i took the code from
AutoOpen.pm) but no mention of it in the logs (and I’ve also turned
debug on). I’m a superuser and it doesn’t work when I reply… unless
I’m also the requester - in which case it does work. If it works when
I’m the requester does that not discount it being a LifeCycle issue?

I hope you know what IsBound means. Right? Take a look at documentation
in lib/RT/Transaction.pm

The only mention is:
[Sat Oct 6 07:20:38 2012] [debug]: Committing scrip #129 on txn
#3256980 of ticket #206853
(/disk1/web/vhost/rt-406/html/rt/sbin/…/lib/RT/Scrips.pm:192)

-Kristian

Best regards, Ruslan.

I hope you know what IsBound means. Right? Take a look at documentation
in lib/RT/Transaction.pm

Ahhh facepalm… must use perldoc more.

Thanks.
-Kristian