Finding username for taken ticket

We want to send a response to the requestor when someone takes their
ticket. The template currently has {$Transaction->NewValue()} where we
want the username to appear. What is the best way to get the username
instead of the user id number?

Jeremy Baumgartner
CAE UNIX Systems Staff

“Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.”

  • Brian W. Kernighan

Try: $Transaction->CreatorObj->Name()

-ToddOn Fri, Oct 08, 2004 at 11:39:28AM -0500, Jeremy Baumgartner wrote:

We want to send a response to the requestor when someone takes their
ticket. The template currently has {$Transaction->NewValue()} where we
want the username to appear. What is the best way to get the username
instead of the user id number?


Jeremy Baumgartner
CAE UNIX Systems Staff

“Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.”

  • Brian W. Kernighan

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

Be sure to check out the RT wiki at http://wiki.bestpractical.com

Todd Chapman wrote:

Try: $Transaction->CreatorObj->Name()

Todd, it’s buggy way. Ownership assigner not allways is new owner.

Jeremy, use next code:

{
my $user = RT::User->new( $RT::SystemUser );
unless( $user ) {
die “Can’t create new RT::User object”;
}
$user->Load( $Transaction->NewValue );
unless( $user->Id ) {
die “Can’t load RT::User #”. $Transaction->NewValue;
}
# Here you can cooperate any user’s properties.
# see also perldoc RT/User.pm
$user->Name();
}