Change owner on Q change

To all,

I hope this gets in, I've tried before and I do not get recognised. 

I have been trying to create a scrip to cause the owner to change to
"nobody" when the Queue is changed. I have also created a new status
that I use as a condition. The following is the code:

— This code sets the owner to nobody for the new queue -----

$RT::Logger->debug(“trying to set owner”);
#my ($code, $msg) = $self->TicketObj->SetOwner(10, ‘Force’);
$self->TicketObj->_Set(Field => ‘Owner’, Value => 10);
#$RT::Logger->debug(“set owner: $code: $msg”);

The ticket changes Queue, but the owner stays the same. If I change the
Queue back to the one where the scrip resides, it gets moved AND the
owner now becomes “nobody”. This doesn’t make any sense. I’ve tried the
code in all three places for user scrip with seperate tests and it’s
always the same. Any help?

Kenn

To all,

I hope this gets in, I've tried before and I do not get recognised. 

I have been trying to create a scrip to cause the owner to change to
"nobody" when the Queue is changed. I have also created a new status
that I use as a condition. The following is the code:

— This code sets the owner to nobody for the new queue -----

$RT::Logger->debug(“trying to set owner”);
#my ($code, $msg) = $self->TicketObj->SetOwner(10, ‘Force’);
$self->TicketObj->_Set(Field => ‘Owner’, Value => 10);
#$RT::Logger->debug(“set owner: $code: $msg”);
#--------------------------------------------------------------------------#

I’m certainly not an RT expert but I see a couple of problems off hand:

$RT::Logger->debug(“trying to set owner”);
my $nobody = RT::User->new($RT::SystemUser);
$nobody->Load(10);

$self->TicketObj->SetOwner($nobody);

By convention, method names that start with _ are private and should

not be called directly.

That code is completely untested, but it may get you going in the right
direction.

Joshua Colson jcolson@voidgate.org