Change queue not triggering Scrip

Hi,

I’ve created a Scrip with condition “On Queue Change” but it
only works when I change the queue via the GUI. I’ve created a little
custom perl module in Actions to change the queue which works great (I’m
calling it from rt-crontool), but it doesn’t trigger the Scrip. Anyone
any ideas what’s going on?

thanks, Andy.

PS the code for my PM is
below:

use strict;
use warnings;
use RT::Queue;
use base
qw(RT::Action);

package RT::Action::Test;

my $self;

sub Prepare {
my
$self = shift;

return 1;
}

sub Commit {
my $self = shift;

my
$argument = $self->Argument;
unless ( $argument ) {

$RT::Logger->error(“Argument is mandatory for Test action”);
return 0;

}

my ($status, $msg) = $self->TicketObj->SetQueue("$argument");
if (
not $status ) {
RT::Logger->error(“Could not reassign queue:
$msg”);
}

return 1;
}

1;

Hi,

I’ve created a Scrip with condition “On Queue Change” but it only works when I change the queue via the GUI. I’ve created a little custom perl module in Actions to change the queue which works great (I’m calling it from rt-crontool), but it doesn’t trigger the Scrip. Anyone any ideas what’s going on?

I’ve noticed that some of the things done with rt-crontool don’t get recorded and therefor don’t trigger scrips. This might be because of something minor missing in your custom perl module (custom action). When the custom perl module changes the queue do you see a transaction listed in the ticket history reflecting the queue change or is the queue just different on the ticket with no mention of it in the ticket history? If there’s no mention of it in the ticket history it means that the transaction is not recorded. This is similar, although not quite the same as, AddCustomFieldValue( Field …, Value …, RecordTransaction => 0 ). I’d probably try and find a way to get the queue change to be recorded in the ticket history that way it would trigger scrips such as the “On Queue Change” one you have that works when using the GUI.

Landon Stewart : lstewart@iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com : +1 (888) 909-4932

signature.asc (203 Bytes)

I’ve noticed that some of the things done with rt-crontool don’t get
recorded and therefor don’t trigger scrips. This might be because of
something minor missing in your custom perl module (custom action).
When the custom perl module changes the queue do you see a transaction
listed in the ticket history reflecting the queue change or is the
queue just different on the ticket with no mention of it in the ticket
history?

Yep, I can see in the ticket “root - Queue changed from” where I am
running the rt-crontool as the root user. So far as I can think that
should be good enough right?

thanks for the input though,

Andy.

Hi Landon et al,

for any interested I did finally get this
working, the trick was adding “RT::Base->_ImportOverlays();” before the
final “return 1” in the commit subroutine. Once I added this the Scrip
with condition on queue change started working as per when changing
queues via the GUI.
So in case anyone else wants a custom action they
can use from rt-crontool for changing queues here is my final
code:

package RT::Action::QChange;

use strict;
use warnings;

use
base qw(RT::Action::Notify);

use Email::Address;

sub Prepare {
my
$self = shift;

return 1;
}

my $self;

sub Commit {

my $self =
shift;

my $argument = $self->Argument;
unless ( $argument ) {

$RT::Logger->error(“Argument is mandatory for Test action”);
return 0;

}

my ($status, $msg) = $self->TicketObj->SetQueue("$argument");
if (
not $status ) {
RT::Logger->error(“Could not reassign queue: $msg”);

return 0;
}

RT::Base->_ImportOverlays();

return 1;
}

1;