[rt-users] adding custom filed value to email
Hello, We are running RT 3.4.5. I created one custom field and would like to add the value that is chosen to the email that is generated. Any help would be greatly appreciated. The custom field name is Locations Thanks in advance, gary _ In a rush? Get real-time answers with Windows Live Messenger. http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_realtime_042008___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] adding custom filed value to email
Hi Gene, I saw this fly by and just couldn't help myself trying to optimise it: On 27 Mar 2008, at 16:04, Gene LeDuc wrote: sub get_custom { my $target_name = $_[0]; my $val = $Ticket-FirstCustomFieldValue($target_name); return $val if defined $val; return undef; } sub get_custom { return $val if $Ticket-FirstCustomFieldValue($_[0]); return undef; } Sorry, it's a pointless opto (just reduces numbers of lines and makes it less readable but that's how we do in perl land right?) but I had a spare 30 seconds :) Regards Huw s2s company email disclaimer: http://www.s2s.ltd.uk/datasheets/email_disclaimer.pdf s2s company registration number : 3952958 s2s VAT registration number : GB763132055 Business premises : Ground Floor, Overline House, Crawley, West Sussex, RH10 1JA Registered address : Heathcote, Kings Road, Ilkley, West Yorkshire, LS29 9AS Place of registration : England ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] adding custom filed value to email
On 27 Mar 2008, at 16:29, Huw Selley wrote: Hi Gene, I saw this fly by and just couldn't help myself trying to optimise it: OK, I suck and actually sent the wrong opto, here is what I wanted to say: sub get_custom { return $val if $Ticket-FirstCustomFieldValue($_[0]) or return undef; } Again, totally pointless but makes the line count prettier :) Huw s2s company email disclaimer: http://www.s2s.ltd.uk/datasheets/email_disclaimer.pdf s2s company registration number : 3952958 s2s VAT registration number : GB763132055 Business premises : Ground Floor, Overline House, Crawley, West Sussex, RH10 1JA Registered address : Heathcote, Kings Road, Ilkley, West Yorkshire, LS29 9AS Place of registration : England ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] adding custom filed value to email
On 27 Mar 2008, at 16:41, Huw Selley wrote: On 27 Mar 2008, at 16:29, Huw Selley wrote: Hi Gene, I saw this fly by and just couldn't help myself trying to optimise it: OK, I suck and actually sent the wrong opto, here is what I wanted to say: And for those that didn't spot the deliberate mistake *cough* : sub get_custom { return $Ticket-FirstCustomFieldValue($_[0]) or return undef; } I promise I will stop now!! Huw s2s company email disclaimer: http://www.s2s.ltd.uk/datasheets/email_disclaimer.pdf s2s company registration number : 3952958 s2s VAT registration number : GB763132055 Business premises : Ground Floor, Overline House, Crawley, West Sussex, RH10 1JA Registered address : Heathcote, Kings Road, Ilkley, West Yorkshire, LS29 9AS Place of registration : England ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] adding custom filed value to email
Now I suck! $Ticket-FirstCustomFieldValue($field_name); Steve ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] adding custom filed value to email
I cut my teeth on APL and used to spend hours shaving 7 or 8 bytes from the size of 360 assembly language programs, so I do have an appreciation for efficient and elegant coding solutions. However... several decades later and who-knows-how-many brain cells fewer, I've found that I spend less time looking up function names and fixing typos using code like: my $custom_field = get_custom(SomeField); and set_custom(SomeField, $my_val); ### I've also developed a new appreciation for comment lines in my old age. :) Gene At 10:13 AM 3/27/2008, Huw Selley wrote: On 27 Mar 2008, at 16:57, Stephen Turner wrote: Please don't Huw, this has been very entertaining ;) :) How about just return $Ticket-FirstCustomFieldValue($_[0]); or even no subroutine - just use $Ticket-FirstCustomFieldValue($_[0]) If you want to ditch the sub $_[0] will always be undef as there will be no @_ (because it's no longer a sub) :) In that case (to use it as a one liner) just: my $custom_field = $Ticket-FirstCustomFieldValue('SomeField'); Huw -- Gene LeDuc, GSEC Security Analyst San Diego State University ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com