Set owner on e-mail correspond

Hi,

I noticed that when a queue watcher replies to an e-mail as a
correspondence, the ticket’s status gets changed to open. Is there a way to
also have it change the owner to the watcher that’s replying?

Thanks.

Eric Mandel
WorldNow

Sure. you’d just want to write a custom scripcondition and scripaction.On Mon, Oct 01, 2001 at 11:41:55AM -0400, Eric Mandel wrote:

Hi,

I noticed that when a queue watcher replies to an e-mail as a
correspondence, the ticket’s status gets changed to open. Is there a way to
also have it change the owner to the watcher that’s replying?

Thanks.

Eric Mandel
WorldNow


rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.

Ancient thread but I’m just going to post my scrip here in case someone else finds it useful:

Condition: On Correspond
Action: User Defined
Template: Blank

Custom action commit code:

my $ticket = $self->TicketObj;
my $trans = $self->TransactionObj;
my $user = $trans->CreatorObj;

# Don't steal
my $owner = $ticket->OwnerObj;
if ($owner->Name ne 'Nobody') {
  return 1;
}
$RT::Logger->debug("Steal check passed.");

# Don't give to requestors.
if (defined $ticket->Requestors->HasMember($user->id)) {
  return 1;
}
$RT::Logger->debug("Requestor check passed.");

# Check if the user has TakeTicket and OwnTicket rights
unless ($user->HasRight(Right => 'TakeTicket', Object => $ticket) && $user->HasRight(Right => 'OwnTicket', Object => $ticket)) {
  return 1;
}
$RT::Logger->debug("Rights check passed.");

# Check that the user who responded is not a service user (a bot).
# They shouldn't own tickets.
my $serviceUserGroup = RT::Group->new($self->CurrentUser);
$serviceUserGroup->LoadUserDefinedGroup('ServiceUsers');
if ($serviceUserGroup->HasMemberRecursively($user->Id)) {
  return 1;
}
$RT::Logger->debug("ServiceUser check passed.");


# All good. Make the change.
$ticket->SetOwner($user);

return 1;

It makes a bunch of tests before setting the owner. You probably want to edit them a little.

Enable it in the Batch stage. Otherwise the ticket owner selected in the response editing view in the UI will overwrite the owner set here.