[rt-users] CFs in Templates?

Gene LeDuc gleduc at mail.sdsu.edu
Thu Dec 13 11:47:32 EST 2007


I'm not sure what your end goal is, but I use the following subroutine in 
my templates when I need to get CFs.  It's mostly from various wiki examples.

   ### Returns custom field value
   ### get_custom($field_name)
   sub get_custom {
     my $target_name = $_[0];
     my $val = $Ticket->FirstCustomFieldValue($target_name);
     return $val if defined $val;
     return undef;
   }

If your CF is named "blahblah" then you get the value with
   $cfval = get_custom('blahblah');

Returns undef if it's not allowed to get the CF or it doesn't exist.

Regards,
Gene

At 07:29 AM 12/13/2007, JB Segal wrote:
>According to http://wiki.bestpractical.com/view/Template_Fields
>"Key  Name                 Meaning
>       CustomField-<id#> => custom field value"
>
>But creating a per-queue 'Correspondence' template which looks exactly
>like the Global 'Correspondence' template with
>CustomField-10: yes
>CustomField-18: yes
>prepended (or just
>CustomField-10
>CustomField-18
>)
>
>just ends me up with a mail message with the lines
>Customfield-10: yes
>Customfield-18: yes
>
>in the headers.
>
>Neither
>http://wiki.bestpractical.com/view/Template
>nor Template_Fields discuss a more detailed mechanism for pulling this
>data out of a ticket and in to mail.
>
>Any help will be much appreciated.
>JB
>--
>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
>_______________________________________________
>http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
>SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:
>
>If you sign up for a new RT support contract before December 31, we'll take
>up to 20 percent off the price. This sale won't last long, so get in touch 
>today.
>     Email us at sales at bestpractical.com or call us at +1 617 812 0745.
>
>
>Community help: http://wiki.bestpractical.com
>Commercial support: sales at bestpractical.com
>
>
>Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
>Buy a copy at http://rtbook.bestpractical.com


-- 
Gene LeDuc, GSEC
Security Analyst
San Diego State University 




More information about the rt-users mailing list