[rt-users] Custom Fields and Templates

Ruslan U. Zakirov cubic at acronis.ru
Tue Mar 2 11:43:22 EST 2004


REPLY TO LIST TOO.
I'm not a BestPractical's support team member. :)

{
    my $CustomFields = $Ticket->QueueObj->CustomFields();
    while (my $CustomField = $CustomFields->Next()) {
      my $CustomFieldValues=$Ticket->CustomFieldValues($CustomField->Id);

      if ($CustomFieldValues->Count) {
        $OUT .= $CustomField->Name . ":\n";
      } else {
        next;
      }

      while (my $CustomFieldValue = $CustomFieldValues->Next) {
        $OUT .= "\t" . $CustomFieldValue->Content . "\n";
      }
    }
    $OUT;
}

What do you think about this??? :)
		Best regards. Ruslan.
Andy Harrison wrote:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> On Tue, 02 Mar 2004 15:31:57 +0300, Ruslan U. Zakirov wrote
> Subject: "Re: [rt-users] Custom Fields and Templates"
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
>>>{
>>
>> >  my $CustomFields = $TicketObj->QueueObj->CustomFields();
>> >  while (my $CustomField = $CustomFields->Next()) {
>> >   $OUT .= $CustomField->Name . "\n";
>> >  }
>> >  $OUT;
>> > } 
>> > 
>> In template code you have $Ticket not $TicketObj.
> 
> 
> 
> DOH!  That was right in front of my face literally.
> 
> Here is what I am trying now.  
> 
> {
>   my $CustomFields = $Ticket->QueueObj->CustomFields();
>   while (my $CustomField = $CustomFields->Next()) {
>     my $CustomFieldValues = $CustomField->Values();
> 
>     $OUT .= $CustomField->Name . ":\t";
>     while (my $CustomFieldValue = $CustomFieldValues->Next) {
>       $CustomFieldValues->LimitToCustomField($CustomField->id);
>       $OUT .= $CustomFieldValue->Name . "\n";
>     }
>   }
>   $OUT;
> }
> 
> My problem now is that for each CF, it is printing all of the possible
> choices instead of printing what the current value is.  I tried the
> LimitToCustomField method described in the perldoc, but it doesn't
> appear to do anything.  I'm not even sure if I'm using it correctly.
> 




More information about the rt-users mailing list