Templating Multiselect Value Inheriticance

I’m using scripts and templates to impliment a workflow. I have a script that creates a child ticket using a template. This was working fine until we changed one of the custom fields into a multiselect. The CustomFieldValue has multiple values, but it seems like the only tool I have available is FirstCustomFiledValue:

Earn Codes: {$ticket->FirstCustomFieldValue(62)}

Does anybody have a way, in a template using Text:Template, to use the entire hash in the template?

You can use arbitrary Perl in these templates, so you aren’t limited to the FirstCustomFieldValue() method. For example you could use CustomFieldValuesAsString() method (from RT::Record that RT::Ticket inherits) or have a more complex loop structure to build a value to insert if you need to do additional checks, etc.

I had tried the CustomFieldValueAsString but what I wound up with was simply the first item selected int he custom field:

Earn Codes: ACA

But, printing it out in he body of the message returned all three values:
Earn Codes: {$ticket->CustomFieldValuesAsString(62)}

Earn Codes: ACA

Open to any advice, or better yet working examples. But the complexity of running this all through Text:Template and the limited size of the project probalby means I will trade the Select multiple box for Enter a Single Value, so I an inherit it in the workflow.

You can also get an iterable CustomFieldValues object:

my $values = $Ticket->CustomFieldValues( $CustomField->Id );
while ( my $Value = $Values->Next ) {
    # Do something with RT::CustomField::Value object

I think my answer is that these routines can copy the parent ticket multi-select values in a scrip that executes on create. But there is no way to pass the multi-select hash in a wat that can be interpretted by Text::Template and put directly into the template that generates the child.


Is the parent ticket available from the template? If so you could do the while loop to find the values of the parent tickets mutiselect custom field