[rt-users] CFs in Templates?
JB Segal
jb at smarterliving.com
Tue Dec 18 12:56:56 EST 2007
Status update: Due to some fine, fine IRC-based help, I've got this
working - mostly.
The problems were:
$OUTPUT was being declared and dumped inside the loop, so nothing was
ever being set,
AND Then, at some point, I introduced 'CFName'... which is not the same
as 'CFname'... which kept anything from working for quite a while.
So what I have now, that mostly works is:
RT-Attach-Message: yes
{ my @CFlist = ('Product', 'Application Area', 'Request Type', 'OK to Outsource', 'Secondary Status');
my $OUTPUT;
foreach my $CFname (@CFlist) {
my $CFvalues = $Ticket->CustomFieldValues($CFname);
while ( my $value = $CFvalues->Next ) {
$CFname =~ s/ /-/g;
$OUTPUT .= "X-${CFname}: ";
$OUTPUT .= (($value->Content ne '') ? $value->Content : 'unset');
$OUTPUT .= "\n";
} } $OUTPUT; }
What's not working about this?
A) Originally I had 'RT-Attach-Message: yes' at the bottom of this, with
no blank line between the "$OUTPUT; }" and the "RT-Attach-Message: yes"
and yet a blank line was being generated and the attachments weren't,
well, attaching.
B) I'm only getthing the 1st 2 CFs - 'Product', 'Application Area' -
populated. Of the 5, they're the only 'Select Multiple' ones, the others
are all 'Select One'.
In discussions on IRC, it was suggested that I look at RT/Record.pm and
how FirstCustomFieldValue and CustomFieldValues are generated. As near
as _I_ can tell, FCFV simply calls CFV and returns the 1st value.
This leaves me perplexed as to why I can't call CFV on a Select One and
have it do the Right Thing(tm).
If anyone has any further suggestions, I'd love to hear them.
(The next expansion of this whole thing is the automatic inclusion of
headers for all CFs appropriate for every given queue. Suggestions as to
what I want to do there are totally welcome.)
JB
> Quoth JB Segal (jb at smarterliving.com):
> > { my @CFlist = ('Product', 'Application Area');
> > foreach my $CFname (@CFlist) {
> > my $CFvalues = $Ticket->CustomFieldValues($CFname);
> > my $OUTPUT;
> > while ( my $value = $CFvalues->Next ) {
> > $CFName =~ s/ /-/g;
> > $OUTPUT .= "X-$CFname: ";
> > $OUTPUT .= ($value->Content eq '') ? $value->Content : 'unset';
> > $OUTPUT .= "\n";
> > }
> > $OUTPUT;
> > }
> > }
> >
> > but this doesn't work.
--
JB Segal 617-886-5575 www.smartertravel.com
Systems/Network Admin. 465 Medford St. Ste 400 www.bookingbuddy.com
Smarter Travel Media LLC Boston, MA 02129 www.tripmania.com
More information about the rt-users
mailing list