[rt-users] User only load by E-mail or by id

Wolfram Huettermann wolfram.huettermann at desy.de
Tue Aug 14 03:29:12 EDT 2012


------------------------------ Message: 2 Date: Mon, 13 Aug 2012 
13:22:50 +0200 From: Gergely Buday <gbuday at gmail.com> To: 
rt-users at lists.bestpractical.com Subject: [rt-users] RT::User problem 
Message-ID: 
<CA+3iOzksxuc4T6hpwyX3=fAeHZsBPwxHyWm3T_-RMeX7UqWs-w at mail.gmail.com> 
Content-Type: text/plain; charset=ISO-8859-1 Hi there, I would like to 
create a User object through the Load method. The documentation writes: 
"Load a user object from the database. Takes a single argument. If the 
argument is numerical, load by the column 'id'. If a user object or its 
subclass passed then loads the same user by id. Otherwise, load by the 
"Name" column which is the user's textual username." #!/usr/bin/perl use 
strict; use lib "/opt/rt4/lib"; use lib "/opt/rt4/local/lib"; use RT; 
use RT::User; RT->LoadConfig; RT->Init; my $test_user = 
RT::User::Load('bg at buday-rd.hu'); printf "\$test_user=", $test_user; my 
@to = $test_user->EmailAddress; for $a (0 .. $#to) { print $to[$a], 
"\n"; } Running this script with sudo makes it say [Mon Aug 13 11:16:47 
2012] [crit]: Can't call method "EmailAddress" on an undefined value at 
./email.pl line 13. (/opt/rt4/lib/RT.pm:341) Can't call method 
"EmailAddress" on an undefined value at ./email.pl line 13. The username 
I used in the place of me at company.com is indeed a valid user name. What 
is the problem then? - Gergely

Hello Gergely,

you can only load a user by id or by E-mail  address. The routine is 
LoadByEmail.


Greetings,

Wolfram


    <https://rt-testsys-1/Developer/Perldoc/Body.html?n=RT::User#___top>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120814/0fb7e134/attachment.htm>


More information about the rt-users mailing list