[rt-users] RT 4.4.1 - Change owner on corrospond Scrip - Strange issue
Kenneth Marshall
ktm at rice.edu
Thu Feb 23 09:19:20 EST 2017
On Thu, Feb 23, 2017 at 08:51:29AM -0500, Alex Hall wrote:
> I'm going to send the email I normally hate to receive. If you ever figure this out, please share it with the list!
>
> I have a script to assign the ticket creator as the owner on creation, which works perfectly. Like you, though, the owner fails to display properly in ticket lists but works if you open a ticket. This has annoyed all our staff for months, but when I asked about on this list, we couldn't work out what the problem was.
>
> Sorry you're running into this, but at the same time, I'm glad to know it's not just me. :)
> > On Feb 23, 2017, at 08:13, Robert Blayzor <rblayzor.bulk at inoc.net> wrote:
> >
> > 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;
> >
Hi Alex and Robert,
What happens if you set RecordTransaction to 1/true? I have not checked the code,
but I would imagine that if you do not record the transaction, the cache infrastructure
would not invalidate the old entry and would continue to serve stale data. Something
to try perhaps.
Regards,
Ken
More information about the rt-users
mailing list