<div dir="ltr"><div>Hi all,<br></div>We have an odd problem. I've put a script in place that sets the requestor of a ticket to be its owner, and that works perfectly when viewing a ticket--the owner is shown as the requestor. The problem is that search results show most tickets as being owned by nobody, but if you click a ticket, you see the owner has actually been set as expected. It's just search results that don't want to show the owner.<br><br>I found this script on the Wiki, and don't know enough about RT's internals to say if it does everything it should. Does anyone see any possible problems with it that would cause the issue with search results?<br><br><br># get actor ID<br>my $Actor = $self->TransactionObj->Creator;<br>#if actor is RT_SystemUser then get out of here<br>return 1 if $Actor == $RT::SystemUser->id;<br>#prevents a ticket being assigned to an unprivileged user, comment out if you want this<br>return 1 unless $self->TransactionObj->CreatorObj->Privileged;<br>#get out unless ticket owner is nobody<br>return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;<br>#try to change owner<br>$RT::Logger->info("Auto assign ticket #". $self->TicketObj->id ." to user #". $Actor );<br>my ($status, $msg) = $self->TicketObj->_Set(Field => 'Owner', Value => $Actor, RecordTransaction => 0);<br>unless( $status ) {<br>    $RT::Logger->error( "Impossible to assign the ticket to $Actor: $msg" );<br>    return undef;<br>}<br><br>return 1;<br clear="all"><div><div><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div>Alex Hall<br></div>Automatic Distributors, IT department<br></div><a href="mailto:ahall@autodist.com" target="_blank">ahall@autodist.com</a><br></div></div>
</div></div></div>