Access Keys:
Skip to content (Access Key - 0)

Auto-assign Tickets based on the day of the week

This article explains how to create a Scrip with a user-defined action to automatically assign tickets as they are created in your queue to different individuals based on the day of the week. This can come in handy if you have different users assigned to keep an eye on your queue traffic for different weekdays.

Context

  • Request Tracker (RT) on help.mit.edu
  • Queue Administrators with the ability to write basic Perl code

Answer

Navigate to your queue's "Scrips" administration page

  1. Go to the Tools menu in RT and navigate to Configuration, then Queues, then Select
  2. Click on the name of your queue in the list of queues
  3. On the Queue Basics administration page go to the Scrips tab and select Create to open a New Scrip form

Fill out the New Scrip form to create your user Scrip

Fill out the form using the list below as a guide. You will of course want to substitute your own usernames for the ticket owners you want to set for the different days of the week.

  • Description: On Create assign a ticket Owner based on day of week
  • Condition: On Create
  • Action: User Defined
  • Template: Global Template: Blank
  • Stage: TransactionCreate

Then fill out the Custom Action Preparation Code and Custom Action Cleanup Code boxes. Leave the Custom Condition box empty.

  • Custom Action Preparation Code:
    return 1;
    
  • Custom Action Cleanup Code:
    my %owners = (
    	'Monday'    => 'othomas',
    	'Tuesday'   => 'joeuser',
    	'Wednesday' => 'othomas',
    	'Thursday'  => 'joeuser',
    	'Friday'    => 'othomas',
    	'Saturday'  => 'joeuser',
    	'Sunday'    => 'othomas'
    );
    my @weekdays = ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
    my ($status, $msg) = $self->TicketObj->SetOwner( $owners{$weekdays[DateTime->now(time_zone => 'America/New_York')->dow - 1]} );
    unless( $status ) {
    	$RT::Logger->error( "Unable to assign ticket #" . $self->TicketObj->id . " to user "
                                . $owners{$weekdays[DateTime->now->dow - 1]} . ": $msg" );
    	return undef;
    }
    

Save and test your work

  1. After filling out the form as above, click the Create button to save and apply your Scrip
    If you get an error at this point, there is a problem with your Perl code in one of the two Custom Action boxes. Review them carefully, and contact tooltime@mit.edu if you get stuck.
  2. Test your scrip by creating test tickets in your queue over the course of the week and verifying that they are auto-assigned to the correct individuals.

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

January 29, 2014

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
request_tracker request_tracker Delete
c-request-tracker c-request-tracker Delete
auto-assign auto-assign Delete
c-rt-queue-admin c-rt-queue-admin Delete
c-rt-enduser-ownership-assignment c-rt-enduser-ownership-assignment Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki