There's actually an example of how to do just this in the book.

Here's mine:

     my $email = ($self->TicketObj->RequestorAddresses)[0];
my $ldap = Net::LDAP->new( 'ldap.somewhere.com' );
       $ldap->bind;
my $msg = $ldap->search( base => 'o=XXXXXXXXXX,c=YY',
                                filter => "(mail=$email)",
                              );
my $entry = $msg->entry(0); my $phone= $entry->get_value('telephoneNumber');
       my $cf = RT::CustomField->new( $RT::SystemUser );
$cf->LoadByName( Name => 'RequestorPhone' ); $self->TicketObj->AddCustomFieldValue( Field => $cf, Value =>
   $phone, RecordTransaction => 0);

       return 1;


-Mike

Mike Peachey wrote:
Jeff Blaine wrote:
I'm looking to fill in custom fields with data retrieved
from an LDAP server.

That is, someone with permission to modify an existing
ticket will enter some data into a custom field, then
save the modification.  At save time, the code will
use that custom field to populate another custom field
with LDAP query results.

Would this best be done as a plugin?  A Scrip?  Other?

You will need a scrip to do it. I'm not aware of any plugin currently
available that could do it for you.

The basics of the scrip shouldn't be too hard, but you're going to need
to set up an LDAP connection, do a valid search, parse the results save
the results etc. There is LDAP code for RT in the ExternalAuth plugin
that may be useful for copying and pasting, but I don't envy you your task.


_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [email protected]

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22 & 23
Dublin, Ireland - Mar 15 & 16
Boston, MA, USA - April 5 & 6
Washington DC, USA - Oct 25 & 26

Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to