On Queue Change, what queue scrip acts?

I am trying to set up scrips for my queues so that when a queue is changed,
the owner in the new queue is set to a default queue owner for that new
queue. It is not working. I have some questions about when the scrips are
run…When the onQueueChange scrip is run, is it run from the old queue’s
scrip or the new queue’s scrip? I am writing it as if it is run in the new
queue - i.e it was in queue A and now it switches to queue B. I want the
scrip to run in queue B that will change it to a default owner for queue B.

Does this make sense?

The code I use is the same code I used to set a default owner on create, but
commented out a few lines.
This is the code that I have in the custom action clean up code for the new
queue (queue B):

my $MyUser = “default owners id”;

my $QueueName = “General”;

return 1 unless $self->TicketObj->QueueObj->Name eq $QueueName;

my $Actor = $self->TransactionObj->Creator;

return 1 if $Actor == $RT::SystemUser->id;

return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;

$RT::Logger->info(“Auto assigning ticket #”. $self->TicketObj->id ." to user
$MyUser" );
my ($status, $msg) = $self->TicketObj->SetOwner( $MyUser );
unless( $status ) {
$RT::Logger->warning( “Impossible to assign the ticket to $MyUser: $msg”
);
return undef;
}
1;

Does anyone see anything wrong? The owner does not change when switching
queues.

View this message in context: http://www.nabble.com/On-Queue-Change%2C-what-queue-scrip-acts--tp15866097p15866097.html

At Wednesday 3/5/2008 11:05 PM, lgrella wrote:

I am trying to set up scrips for my queues so that when a queue is changed,
the owner in the new queue is set to a default queue owner for that new
queue. It is not working. I have some questions about when the scrips are
run…When the onQueueChange scrip is run, is it run from the old queue’s
scrip or the new queue’s scrip? I am writing it as if it is run in the new
queue - i.e it was in queue A and now it switches to queue B. I want the
scrip to run in queue B that will change it to a default owner for queue B.

Does this make sense?

The code I use is the same code I used to set a default owner on create, but
commented out a few lines.
This is the code that I have in the custom action clean up code for the new
queue (queue B):

The scrip fires on the new queue, so you’re on the right track.

Did you remember to set the action to ‘User defined’? Do you see
anything in the RT log from your debug statements?

Steve

At Thursday 3/6/2008 10:20 AM, Laura Grella wrote:

Thank you so much for your reply.
It actually works, but the way I was testing it was making me think it didn’t.
If the ticket changed to a queue where the owner had rights in the
new queue also, it didn’t change the owner to the default. At first
I thought it needed to always change to the default, but it is ok if
it works this way.

How do I check the RT log? I have not used any debug statements, but
this would come in handy in the future.

Thanks,
Laura

Hello Laura,

Glad it’s working - I should have said logging statements, rather
then debug statements. Lines like this should show up in the RT log,
depending on config settings:

$RT::Logger->info(“Auto assigning ticket #”. $self->TicketObj->id .“
to user $MyUser” );

The RT log by default is in $RTHOME/var/log

Steve

Thanks!

Stephen Turner wrote:

At Thursday 3/6/2008 10:20 AM, Laura Grella wrote:

Thank you so much for your reply.
It actually works, but the way I was testing it was making me think it
didn’t.
If the ticket changed to a queue where the owner had rights in the
new queue also, it didn’t change the owner to the default. At first
I thought it needed to always change to the default, but it is ok if
it works this way.

How do I check the RT log? I have not used any debug statements, but
this would come in handy in the future.

Thanks,
Laura

Hello Laura,

Glad it’s working - I should have said logging statements, rather
then debug statements. Lines like this should show up in the RT log,
depending on config settings:

$RT::Logger->info(“Auto assigning ticket #”. $self->TicketObj->id ."
to user $MyUser" );

The RT log by default is in $RTHOME/var/log

Steve


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

View this message in context: http://www.nabble.com/On-Queue-Change%2C-what-scrip-acts-in-which-queue---old-or-new--tp15866097p15877184.html