[rt-users] Newbie question regarding Custom Fields in Templates

Garry T. Williams garry.williams at cbeyond.net
Mon Nov 13 10:48:07 EST 2006


On Thursday 09 November 2006 22:10, Bill Weaver wrote:
> When I try to reference that within a
> Template like this: 
> 
> To: {$Ticket->FirstCustomFieldValue('Email');} 
> 
> It returns undef. 

You want to do something like this instead:

    To: {
	my $email;
	my $val = $Ticket->CustomFieldValues('Email')->First();

	if ($val) {
	    $email = $val->Content();
	}

	# no value for 'Email' CF
	else {
	    $email = 'root at localhost';
	}

	$email;
    }

See RT/Ticket_Overlay.pm and RT/Record.pm .

-- 
Garry T. Williams --- 678-370-2438




More information about the rt-users mailing list