[rt-users] RT 4.4.1 - Change owner on corrospond Scrip - Strange issue
Robert Blayzor
rblayzor.bulk at inoc.net
Thu Feb 23 08:13:28 EST 2017
Running RT 4.4.1 - running fine for years and probably never noticed this before. We have a Scrip that runs that probably carried over from the pre-RT4 days.
Pretty common function is to change the Owner of the ticket from “Nobody” to the first person to correspond if they are a privileged user in RT. The Scrip is below and it does work. (kind of).
What works: When user is first to correspond, Scrip executes and in Ticket view the Owner is set as expected.
What doesn’t work: If we go into the queue and list all the open tickets, the owner will be listed as “nobody” in this view, but if you open the ticket, there is an owner. If you change the owner to someone else and change it back, then it seems to fix this issue.
Is this just a display bug or are we not using the proper method to change the owner of the Ticket?
Here is the Scrip we’ve been using:
# Condition: On correspond
# Action: User Defined
# Template: blank
my $Actor = $self->TransactionObj->Creator;
my $Queue = $self->TicketObj->QueueObj;
# if actor is RT_SystemUser then get out of here
return 1 if $Actor == $RT::SystemUser->id;
# get out unless ticket owner is nobody
return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;
# get out unless $Actor is not part of AdminCc watchers
return 1 unless $Queue->IsWatcher(Type => 'AdminCc', PrincipalId => $Actor);
# do the actual 'status update'
my ($status, $msg) = $self->TicketObj->_Set(Field => 'Owner', Value => $Actor, RecordTransaction => 0);
unless( $status ) {
$RT::Logger->warning( "Can't set ticket owner to $Actor: $msg" );
return undef;
}
return 1;
More information about the rt-users
mailing list