RT 4.4.1 - Change owner on corrospond Scrip - Strange issue

Robert Blayzor <[email protected]> Thu, 23 Feb 2017 08:13:28 -0500
Newsgroups gmane.comp.bug-tracking.request-tracker.user
Message-ID <[email protected]>
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 =
=E2=80=9CNobody=E2=80=9D 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=E2=80=99t work: If we go into the queue and list all the open =
tickets, the owner will be listed as =E2=80=9Cnobody=E2=80=9D 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=E2=80=99ve been using:

# Condition: On correspond
# Action: User Defined
# Template: blank
=20
my $Actor =3D $self->TransactionObj->Creator;
my $Queue =3D $self->TicketObj->QueueObj;

# if actor is RT_SystemUser then get out of here
return 1 if $Actor =3D=3D $RT::SystemUser->id;

# get out unless ticket owner is nobody
return 1 unless $self->TicketObj->Owner =3D=3D $RT::Nobody->id;

# get out unless $Actor is not part of AdminCc watchers
return 1 unless $Queue->IsWatcher(Type =3D> 'AdminCc', PrincipalId =3D> =
$Actor);

# do the actual 'status update'
my ($status, $msg) =3D $self->TicketObj->_Set(Field =3D> 'Owner', Value =
=3D> $Actor, RecordTransaction =3D> 0);
unless( $status ) {
  $RT::Logger->warning( "Can't set ticket owner to $Actor: $msg" );
  return undef;
}
return 1;