[rt-users] RT 4.4.1 - Change owner on corrospond Scrip - Strange issue

Shawn M Moore shawn at bestpractical.com
Thu Feb 23 12:06:48 EST 2017

Hey Robert, Alex,

> Is this just a display bug or are we not using the proper method to change the owner of the Ticket?

You're not using the proper method.

> # do the actual 'status update'
> my ($status, $msg) = $self->TicketObj->_Set(Field => 'Owner', Value => $Actor, RecordTransaction => 0);

Should instead be:

my ($status, $msg) = $self->TicketObj->SetOwner($Actor);

> 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.

The reason you need to use SetOwner is that the owner of a ticket is represented in two different database tables. The first is in the GroupMembers table, alongside Requestors, Ccs, and AdminCcs, and custom roles. This is what provides features like permissions. It's also what's used when you display the "Owner" column in search results. Tickets _also_ store their owner denormalized in the tickets table. This is used in, among other places, displaying the owner on ticket display, and in email notifications.

->Set(Field => 'Owner') only updates the latter. ->SetOwner updates both.

This explains the inconsistencies you're seeing. Please try switching your scrip to ->SetOwner and seeing if it helps for tickets going forward. For existing tickets with this problem, you'll need to address the consistency issue.

It turns out that, for different reasons entirely ( https://issues.bestpractical.com/Ticket/Display.html?id=32381 <https://issues.bestpractical.com/Ticket/Display.html?id=32381> ), RT 4.4.2 adds an upgrade step and an rt-validator rule that detects and fixes such inconsistencies. You can find them here:

https://github.com/bestpractical/rt/commit/58bacce6ada754657c7f56fd91f20c573108c1ab <https://github.com/bestpractical/rt/commit/58bacce6ada754657c7f56fd91f20c573108c1ab>
https://github.com/bestpractical/rt/commit/20d8daf6855e3c53ee8a79d68271941d4cdca159 <https://github.com/bestpractical/rt/commit/20d8daf6855e3c53ee8a79d68271941d4cdca159>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20170223/95982b17/attachment.html>

More information about the rt-users mailing list