On Thu, Feb 17, 2011 at 09:09:29AM -0500, Joe Kirby (gmail) wrote:
>    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;

Use $RT::Logger->warning to tell if you have the right data 

Also make sure you're still using the error checking code that you paste:

       unless( $st ) {
         $RT::Logger->warning( "Couldn't set $DefaultValue as value for CF 
$CFName:". $msg );
         return undef;
       }

-kevin

>    # 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;
>       }
>     }

Attachment: pgpOUI3qFTVsD.pgp
Description: PGP signature

Reply via email to