[rt-users] Best practices: Queues vs. Custom fields

Mike Patterson mikep at uclink.berkeley.edu
Wed Feb 1 15:45:05 EST 2006


I was able to add Dept information to a ticket custom field from LDAP 
based on the example in the RT Essentials book (pg 81).

--------
Note you need to add this at top of the code:
"use Net::LDAP;"
Also for my older build I had to use LoadByNameAndQueue instead of 
LoadByName
Queue '0' is for custom fields that apply to all queues.
#$cf->LoadByName( Name => 'Department' );
$cf->LoadByNameAndQueue( Name => 'Department', Queue => '0');
--------

If you want to use the existing statistics add-on for reporting 
(http://wiki.bestpractical.com/index.cgi?RT3StatisticsPackage) you 
should pick the most important attribute: either Department or Tasktype 
to base your queues on, since those stats are based on queues.

Currently I'm trying to figure out a better way to do custom reporting 
by department using the API. I'd like to write a CustomAction that 
writes some stats to a file and launch it using rtcrontool.  Any hints 
would be appreciated.

Working outside of the API to write reports on departments (PHP + MySQL) 
I've learned a few things:
-----------------
1) The Ticket.Creator and the Requestor don't always stay the same (e.g. 
someone sends a email to me, I forward it to RT, then afterwards change 
the "people" so that requestors email address used instead of mine.  
When this happens creator and requestor are different.

2) A query to match the requestor to a ticket is a complicated join 
(http://wiki.bestpractical.com/index.cgi?GetReqestorInfoByTicketId).  It 
is a simpler query to join a ticket custom field to the ticket.  I used 
to put Dept information in the existing Users.Organization field, but 
now I use a Ticket customfield for Dept instead.

3) Merged tickets can do funny things to statistics.  If I do a simple 
query counting all tickets created, then do another query grouping by 
department, the sum of the grouped-by-department won't equal all tickets 
unless I exclude tickets where (id != EffectiveId).
-----------------

MikeHamilton at clovisusd.k12.ca.us wrote:

>
> My advice would be to have a queue per department. Whether or not 
> there is a best practice, I'm not sure, but since your tickets are 
> going to be coming in via email, a custom field means that someone has 
> to look at the ticket and then enter the correct data in the custom 
> field. If you sort them as queues by department, then you can have an 
> individual email address for each queue and the tickets would 
> auto-sort by department since the queue is dedicated to that department.
> I'm sure someone clever will find a way to do an LDAP lookup and get 
> the department field auto populated, but if you cannot do that, then 
> each department having a queue would be much easier. 



-- 
Mike Patterson
Systems Manager
UC Berkeley Extension




More information about the rt-users mailing list