[Rt-devel] Custom Field Conditions in Template

beikaixin casey at seeqpod.com
Tue Feb 19 19:22:35 EST 2008


Here's my template code (edited for privacy). I'm not a perl expert, so you
might see an obvious mistake that I missed. 


-------------begin template code-----------------------

{ my $webvalues = $Ticket->CustomFieldValues('UI bug tracking link');
  my $datavalues = $Ticket->CustomFieldValues('Backend bug tracking link');
  my $OUTPUT;

 
  while ( my $value = ($webvalues->Next) ) {
    $OUTPUT .= "UI bug tracking Link: https://somewebsite.com/view.php?id=";
    $OUTPUT .= $value->Content;
    $OUTPUT .= "\n";
  }

  while ( my $values = ($datavalues->Next) ) {
    $OUTPUT .= "Backend bug tracking link:
http://somewebsite2.com/view.php?id=";
    $OUTPUT .= $values->Content;
    $OUTPUT .= "\n";
  }

$OUTPUT;
$Transaction->Content();
}


------------end template code-----------



Garry T. Williams-2 wrote:
> 
> On Friday 15 February 2008 16:25:16 beikaixin wrote:
>> I am using the code found at
>> http://wiki.bestpractical.com/view/AddCustomFieldstoTemplates to iterate
>> over and display the multi-valued custom fields. The main problem is,
>> this
>> only works when both custom fields have at least one value (actually,
>> it's
>> broken again now, but it has worked in the past, only under these
>> conditions).
> 
> I just ran a test and Ticket::CustomFieldValues() returns an
> RT::ObjectCustomFieldValues object for me even when the ticket does
> not have a value for the custom field in question.  When there is no
> value, the first call to RT::ObjectCustomFieldValues::Next() returns
> false.
> 
> The code you site appears to be correct.
> 
> Maybe you need to be more specific about what your code actually is
> and what results you actually get.
> 
> -- 
> Garry T. Williams --- 678-370-2438
> 
> _______________________________________________
> List info:
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
> 
> 

-- 
View this message in context: http://www.nabble.com/Custom-Field-Conditions-in-Template-tp15445728p15579595.html
Sent from the Request Tracker - Dev mailing list archive at Nabble.com.



More information about the Rt-devel mailing list