I submitted a question a week or so ago and I still cannot solve my problem.

Please know I have searched the wiki quite a bit and have tried several adaptations of different scenarios to try and achieve my goal.

I would like to have a custom field which is set at Transaction time to the Requestors Initial of the Last Name.

I have tried using

my $RequestorRealName = $self->TicketObj->CreatorObj->RealName;
my $RequestorRealName = $Ticket->Requestors->UserMembersObj->First->RealName;

# Split the name into an array
my @nameArray = split(/\s+/, $RequestorRealName);

# Extract the first letter of the last element of the array
my $LastInitial = substr(pop(@nameArray), 0, 1);

I cannot even get the CF value to become the whole name which makes me think I am not using the correct obj name??

At the risk of being a pain I am resubmitting.

Please tolerate my persistence and I will not post again

Thanks

Joe

PS: Here is the code I am using to set the value which I had gotten a while back for another situation and it works fine in my other situation.

unless( $self->TicketObj->FirstCustomFieldValue( $CFObj->id ) ) {
   my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue(
                                         Field => $CFObj->id,
                                         Value => $RequestorRealName,
RecordTransaction => $RecTransaction );
   unless( $st ) {
$RT::Logger->warning( "Couldn't set $DefaultValue as value for CF $CFName:". $msg );
     return undef;
   }
 }

--
Joe Kirby , Assistant Vice President, Business Systems
Division of Information Technology (DoIT)
Support Response - http://www.umbc.edu/oit
Administration 627
Office - 410-455-3020
Email - [email protected]

Reply via email to