Filling in custom fields from LDAP

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?

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.

Kind Regards,

Mike Peachey, IT
Tel: +44 114 281 2655
Fax: +44 114 281 2951
Jennic Ltd, Furnival Street, Sheffield, S1 4QT, UK
Comp Reg No: 3191371 - Registered In England

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:

Hi,

I installed RT and I’m very happy with the result.
I have about 2,500 tickets a month around 100 people working on 20 queues.
Installed Active Directory authentication and many other plugins.

Now I want to go further. I was googling to find a Survey plugin.
I want to send a message to requestors and ask them to reply a survey.

Is there someting like that in RT?

Thanks.

Elton S. Fenner,
Analista de Rede,
Assembl�ia Legislativa do RS.
+55 51 3210-1249

You could just have the resolved template include a link to a survey
monkey. http://www.surveymonkey.com/On Mon, Mar 29, 2010 at 5:15 PM, Elton S. Fenner elton.fenner@al.rs.gov.br wrote:

Hi,

I installed RT and I’m very happy with the result.
I have about 2,500 tickets a month around 100 people working on 20 queues.
Installed Active Directory authentication and many other plugins.

Now I want to go further. I was googling to find a Survey plugin.
I want to send a message to requestors and ask them to reply a survey.

Is there someting like that in RT?

Thanks.

Elton S. Fenner,
Analista de Rede,
Assembléia Legislativa do RS.
+55 51 3210-1249

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

You could just have the resolved template include a link to a survey
monkey. http://www.surveymonkey.com/

Thanks, I’m gonna take a close look at this.
Elton> On Mon, Mar 29, 2010 at 5:15 PM, Elton S. Fenner elton.fenner@al.rs.gov.br wrote:

Hi,

I installed RT and I’m very happy with the result.
I have about 2,500 tickets a month around 100 people working on 20 queues…
Installed Active Directory authentication and many other plugins.

Now I want to go further. I was googling to find a Survey plugin.
I want to send a message to requestors and ask them to reply a survey.

Is there someting like that in RT?

Thanks.

Elton S. Fenner,
Analista de Rede,
Assembléia Legislativa do RS.
+55 51 3210-1249

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

  • Caro usu�rio, se este e-mail n�o foi corretamente classificado como spam, encaminhe para spam@dspam.al.rs.gov.br. (+ informa��es ? Ligue 1080)

!DSPAM:8,4bb1231a19908650115250!

You could just have the resolved template include a link to a survey
monkey. http://www.surveymonkey.com/

In our organization, we don’t include Transaction Content in the email
templates. So for us, a link to a survey in that email (which does not
include our actual reply to the ticket, just a notice to come see the
ticket in web SelfService) would not make sense.

Therefore, we have a local mod to SelfService/Display.html that will
offer unprivileged users a link to a survey when the ticket is in
resolved or autoclose status, and a customfield (applied to whichever
queues you want, and with Group perm “SeeCustomField” for “Everyone”)
flag is unset.

We chose to use a survey created in Google Docs instead of
surveymonkey because we already use Google Apps in our org. But Google
Surveys redirect people at the end to a dead-end Google page instead
of a configurable page, so we needed to alter the html supplied by the
Google Survey. We also needed a place to flip a switch on the RT
CustomField that flags whether the user has visited the survey, so we
know when to stop offering a link to it.

So, we wrapped the Google Survey in a PHP script. The link to that
script from the ticket carries the ticket ID in the querystring. So
the PHP script knows the Ticket ID. The survey asks for the ticket
number in the 3rd question, so appending &entry_2=N to the url to the
google survey generates the form with “N” already filled in as the
answer to question #3.

We used file_get_contents() to get the html from Google and then
DOMxml functions to alter it, adding some code that you can find on
the web that targets the form to a hidden iframe in the page (to bury
google’s dead-end “thank you” page) and javascript to then redirect
the user in the main window to the “thank you” page you want, which
for us is back to the ticket. We make sure that if the user was in RT
over SSL, they are redirected back to RT over SSL so they get back in
with the same session.

After the PHP wrapper fixes the html for the survey form, and before
displaying it to the user, it exec()'s the rt cli to set the
“MySurvey” customfield flag, signaling not to show the survey link on
that ticket anymore:

rt edit ticket/12345 set CF-MySurvey="1"

In order to use the cli, we had to create another privileged user for
that purpose with Global perms to ShowTicket,ModifyTicket and local
perm SeeCustomField,ModifyCustomField for the “MySurvey” CF.

Having to make a new user and keep its password in the PHP wrapper is
kind of messy. It probably would have been better to add an AJAX call
in the wrapped survey form upon submit that would contact RT with the
user’s existing session to flip that CF flag. I just didn’t know where
to begin to make (or recycle) an RT page that would process such a
request to set a value for that customfield.

A