[rt-users] How to grab requestor's first and last name in email address ?

Kevin Falcone falcone at bestpractical.com
Thu Feb 6 11:27:11 EST 2014

On Thu, Feb 06, 2014 at 01:02:22PM +0000, Ethier, Michael wrote:
>    When I try this code, it runs but it's not outputting what I need:
>    my $trueuser = $TicketObj->Requestors->UserMembersObj->First->RealName;
>    $RT::Logger->debug("trueuser is: ".$trueuser);
>    Resulting output looks to be whatever is before the "@" in the email address, not the
>    RealName:
>    [3263] [Thu Feb  6 12:55:07 2014] [debug]: trueuser is: ethier ((eval 625):28)

RealName is set to the Email Address' 'phrase' which is the "Smith,
Joe" you mention.  I suspect your test email isn't sending what you
expect.  Or, the user already exists in your system with that bogus
RealName (you can confirm this by searching for the user in the admin
UI and reading the History tab).

You may want to try
$self->TransactionObj->ContentObj->GetHeader('From') and parse it
manually if you can't trust your Users table (which is what Requestors
is searching).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 235 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140206/0af29352/attachment.sig>

More information about the rt-users mailing list