<div dir="ltr"><div>On 5 February 2014 11:16, Ethier, Michael <span dir="ltr"><<a href="mailto:methier@cgr.harvard.edu" target="_blank">methier@cgr.harvard.edu</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I need to obtain the first and last name that would be part of the requestor’s email address.<u></u><u></u></p>
<p class="MsoNormal">For example, requestor email address comes in as:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">From: "Smith, Joe" <<a href="mailto:jsmith@mail.com" target="_blank">jsmith@mail.com</a>><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">In this example I want parse out the “Joe” and “Smith” keywords and assign them to 2 variables
<u></u><u></u></p>
<p class="MsoNormal">which I will use for comparison later.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I am writing a RT Scrip. Is this possible to do ?</p></div></div></blockquote><div><br></div><div><div>The “name” of the requestor is stored within the UsersObj in the Requestors group object for the $Ticket. You want the first UsersObj. There’s no way to know if it’s the name is written "Last, First" or “First Last” so you’ll have to figure that out somehow. Usually a comma in a name field means “Last, First” though so the following is a decent bet. I haven’t tested this code but this ought to get you close anyway.</div>
<br>my $realname = $self->TicketObj->Requestors->UsersObj->First->RealName;<br># Switch things around if there’s a comma in the field.<br>$realname =~ s/(.*),\s*(.*)/$2 $1/ if $realname =~ /,/;<br></div><div>
<br></div><div>If they have “First Last, Company” it’ll come out as “ACME Inc., Jim Smith” though which might not be terrible.</div><div>Worse would be “Last, First - Position” coming out as “Jim - Manager Smith” which might sound a little too familiar for business.</div>
<div><br></div><div>In my opinion you’d want to just leave it as-is so if it’s Last, First and they get an email addressed to them with “Dear Smith, Jim:” they’ll know it’s because they have it that way in their mail client.</div>
<div><br></div></div>-- <br><div dir="ltr"><div><span style="font-family:arial;font-size:small">Landon Stewart :: </span><a href="mailto:lstewart@iweb.com" style="font-family:arial;font-size:small" target="_blank">lstewart@iweb.com</a><br>
</div><span style="font-family:arial;font-size:small">Lead Specialist, Abuse and Security Management</span><br style="font-family:arial;font-size:small"><span style="font-family:arial;font-size:small">Spécialiste principal, gestion des abus et sécurité</span><br style="font-family:arial;font-size:small">
<span style="font-family:arial;font-size:small"><a href="http://iweb.com" target="_blank">http://iweb.com</a> :: +1 (888) 909-4932</span><br><div><span style="font-family:arial;font-size:small"><br></span></div><div><span style="font-family:arial;font-size:small"><br>
</span></div></div>
</div></div>