[Rt-devel] Question on Extracting Custom Field Values

HKG RI-CI/LIU, YANFAT yanfat.liu at kuehne-nagel.com
Mon Jul 9 05:00:45 EDT 2007


Hi all,

I'm having a "multi-values" custom field. And I have to extract contents of
all custom field values for further usage.
So, I customize the "ExtractCustomFieldValues.pm" which is available from
wiki.
Here is part of my 'scrip-action', with all CF values ouput stored in
"@value".
Can anyone spot my bug(s) or comment on it?



my $target_CFname = 'Status';
my @value;

my $QueueObj = $self->TicketObj->QueueObj;
my $CFObj = RT::CustomField->new( $QueueObj->CurrentUser );
$CFObj->LoadByNameAndQueue( Name => $target_CFname, Queue =>
$QueueObj->id );
unless( $CFObj->id ) {
	$CFObj->LoadByNameAndQueue( Name => $target_CFname, Queue => 0 );
	unless( $CFObj->id ) {
		$RT::Logger->warning("custom field '$target_CFname' isn't global or
defined for queue '". $QueueObj->Name ."'");
		return undef;
    	}
}

if ( $self->TicketObj->FirstCustomFieldValue( $CFObj->id ) ) {
	my $CustomFieldValues = $self->$TicketObj->CustomFieldValues($CFObj->Id);
	while (my $val = $CustomFieldValues->Next) {
    		push  @value, $val->Content;
 	 }
}


Best Regard,

Steven Liu
HKG RI-CI

Tel: +852 2823 4396
Email: yanfat.liu at kuehne-nagel.com



More information about the Rt-devel mailing list