So my double header post on getting this funky AD lookup control with Perl (post 1 & post 2) was actually prep work for getting to work in a product called RT (or Request Tracker from BestPractical) which is built on Perl. I have never worked with it before so I am slightly (read: exceptionally) ignorant of how to do this. Effectively I want a lookup to include AD users.
The first thing I saw was this Include Page option when creating a field, which is described as
RT can include content from another web service when showing this custom field. Fill in this field with a URL. RT will replace __id__ and __CustomField__ with the record id and custom field value, respectively Some browsers may only load content from the same domain as your RT server.
Sounds perfect, turns out there is NO knowledge of how this works. I tried various forums and news groups, even emailing people who asked before about it… no answers are available! The documentation is USELESS!
Another option is once you have created a field a new option appears: Field values source:
So how do you actually use this without typing in the options yourself?
Well in the /opt/rt3/lib/RT/CustomFieldValues is a file called Groups.pm which allows you to provide the names of the groups as a field source. So this is a possible solution, but first you need to create the module. The module has two methods:
SourceDescription - Which needs to return a string containing the name of what you are returning.
ExternalValues - Which needs to return an array of objects which contain the values. Those object must have a name property which is the name you want to show, and two optional properties description which is the… actually I dunno where it’s used (don’t think it is) and sortorder which you use to do the sorting. So taking the AD code previous the previous posts and combining it into the right format we end up with this code:
So we bundle that nicely in to AD.pm and dump that into the folder.
So how do we use that module? Well you need to go to /opt/rt3/etc and edit the RT_SiteConfig.pm file and add the following line to it: Set(@CustomFieldValuesSources, "RT::CustomFieldValues::AD");
Next restart Apache (the command I used was: apache2ctl restart) and go back to the field properties and you should be able to select it.
A few things about building these that I learnt along the way
Hopefully this helps you develop with RT, and that this (overcomplicated) process is easier.