[rt-users] Custom Scrip Failing (using example from RT Essentials)and User Details not accessible
Michael Ellis
michael_ellis at umanitoba.ca
Thu Aug 6 14:31:58 EDT 2009
Although there might be better ways of doing this, the reason this scrip wasn't working is simply some wrongly placed quote marks in like 6. Fixed and it works. That's what I get for trying to work at after midnight.
-Mike
From: Michael Ellis
Sent: Thursday, August 06, 2009 12:31 AM
To: RT-USERS
Subject: [rt-users] Custom Scrip Failing (using example from RT Essentials)and User Details not accessible
One of the biggest complaints from my privileged users during our testing of RT is that the requestor's phone number is not presented to them conveniently. We currently handle the bulk of our support by phone, so some of them are standing at my office door with torches and pitchforks.
To rectify this I am trying to implement the custom scrip found on page 81 of the RT Essentials book, and customize it to pull up phone numbers instead of departments.
The customized scrip is:
1 my $email = ($self->TicketObj->RequestorAddresses)[0];
2
3 my $ldap = Net::LDAP->new( 'someserver.umanitoba.ca' );
4 $ldap->bind;
5
6 my $msg = $ldap->search( base => 'o="University of Manitoba,c="ca"',
7 filter => "(mail=$email)",
8 );
9
10 my $entry = $msg->entry(0);
11
12 my $phone= $entry->get_value('telephoneNumber');
13
14 my $cf = RT::CustomField->new( $RT::SystemUser );
15 $cf->LoadByName( Name => 'RequestorPhone' );
16
17 $self->TicketObj->AddCustomFieldValue( Field => $cf, Value => $phone);
18
19 return 1;
Changes from the original are
3 Server
6 Base
7 email -> mail (what our non-standard ldap calls it)
12 $dept -> $phone
15 my custom field
17 $dept -> $phone
The custom field RequestorPhone is not being set, though. RT's debug log shows the entry:
[error]: Scrip 16 Prepare failed: Can't call method "get_value" on an undefined value at (eval 8643) line 12.
Could someone help me get this working, or share what they have done?
Secondly, I am having an issue that when my privileged users click on a requestor in the people tab of a ticket, they are presented with:
"Time to display: 0.009515
»|« RT 3.8.4 Copyright 1996-2009 Best Practical Solutions, LLC."
Root/Superuser is taken to the requestor's details.
So right now, my people have no way to obtain the requestor's phone number from within RT. So what are they doing is falling back to our old helpdesk system and in frustration entering the calls there. This is jeopardizing the acceptance and adoption of RT as a replacement for our old system.
I'm sure that I've made one or two (or more) simple errors and wish I could spend more time looking into this before going to the forum, but the townspeople are at the castle gates.
TIA,
Mike
--------------------------------------------------------------------------------
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com
Commercial support: sales at bestpractical.com
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090806/c780c20d/attachment.htm>
More information about the rt-users
mailing list