How can I automatically make the first responder the Owner of a Ticket?
- How can I configure my Request Tracker (RT) queue to automatically assign a ticket to the first person who replies to it?
- How can I add a Scrip to my Queue that sets the Ticket Owner to the first person to Correspond with the Requestor?
Context
- Request Tracker (RT) 4.0
- Ticket tracking at MIT
- Queue administrators in RT on help.mit.edu
Answer
If you have your Request Tracker (RT) queue set up to notify staff of new tickets as they come in, and staff sometimes or always respond to the Requestor via email rather than going into RT and responding via the web interface, it can be quite useful to automatically make the first staff member to respond to a request the Owner of that ticket. This can be done through a "scrip" attached to your queue.
![]() | Writing custom Perl code in Scrips Please note that, even as a queue administrator, you may not have permission to create user defined actions and conditions in your scrip. Using this functionality requires in-depth understanding of RT and knowledge of Perl, and is not a right automatically granted to queue administrators. Please contact tooltime@mit.edu if you would like us to set this up for you on your queue, or if you'd like to talk about expanded queue administrator permissions. |
Steps to set this scrip up for a queue
- Hover your mouse over the "Tools" expanding nav button and select "Configuration", then "Queues", then "Select" from the menu that pops up
- Find your queue in the list of queues when it finishes loading, and click on it
- Hover your mouse over the "Scrips" expanding nav button and select "Select"
- Visually inspect the list of scrips that currently apply to your queue to refresh your memory on the notifications and automatic actions already in place for your queue
- Hover your mouse over the "Scrips" expanding nav button again and select "Create"
- On the form page to create a new scrip, verify that you can see a section titled "User Defined conditions and actions"; if you do not see this section, you cannot complete these instructions yourself and need to request that this be set up for you by sending mail to tooltime@mit.edu
- If you can see the section titled "User Defined conditions and actions" then proceed to fill out the new scrip form as follows:
- In the section "Scrip fields":
- Description = On Correspond set Owner to the Current User if possible
- Condition = On Correspond
- Action = User Defined
- Template = Global Template: Blank
- Stage = TransactionCreate
- In the section "User Defined conditions and actions":
- Leave the box "Custom condition" blank
- In the box "Custom action preparation code" enter:
return 1;
- In the box "Custom action cleanup code" enter:
my $Actor = $self->TransactionObj->Creator; return 1 if $Actor == $RT::SystemUser->id; return 1 unless $self->TicketObj->Owner == $RT::Nobody->id; $RT::Logger->info("Auto assign ticket #". $self->TicketObj->id ." to user #". $Actor ); my ($status, $msg) = $self->TicketObj->SetOwner( $Actor ); unless( $status ) { $RT::Logger->error( "Impossible to assign the ticket to $Actor: $msg" ); return undef; } return 1;
- In the section "Scrip fields":
Caveats
How the Scrip works/succeeds/fails
This Scrip will trigger on every Correspondence, but will exit quickly and silently if a) the Ticket already has an Owner set or b) the Correspondence is created by someone who's not a valid Actor on the ticket (i.e. SystemUser). If the Correspondence is created by a valid Actor, but the Actor does not have permissions to own tickets in this queue, the Scrip will also fail but an error will be logged. This can happen if the Requestor sends a follow-up message (Correspondence) to the ticket before any staff members reply to the initial message.
For email Correspondence, RT will use the sender information to determine the Actor. This means you need to send your Reply from the email address associated with your RT user record. This is usually your @mit.edu address, but may be a different if you haver associated a different address, for example your @media.mit.edu or your Gmail address, with your entry in the MIT directory.
Notifications
You may want to enable Owner notifications for your RT queue if you turn this on. In particular, you may want to add the stock Scrip On Owner Change Notify Owners with template Owner Change to your queue if it is not already there. Any staff who also have "Notify Actor" set to "Yes" in their personal options will then receive a short email confirmation that the ticket was successfully assigned to them on their initial reply.
See also
- This article borrows liberally from the contributions to the Best Practical RT wiki at http://requesttracker.wikia.com/wiki/AutoSetOwner.