RT REST interface supporting multi-valued custom fields con creation

Hello, everyone.

I’ve been struggling with REST RT to achieve support for multi-valued CF. It handles them well while editing an existing ticket, but fails to handle them when creating a new ticket (treating them as a whole).

So I’ve patched the file “html/REST/1.0/Forms/ticket/default” in my own extension to get it working:​

@@ -169,7 +169,19 @@
delete $data{$k};
next;
}

  •            $v{"CustomField-".$cf->Id()} = delete $data{$k};
    
  •            if ( $cf->SingleValue ) {
    
  •              $v{"CustomField-".$cf->Id()} = delete $data{$k};
    
  •            }
    
  •            else {
    
  •              my @cfvalues = split ',',$data{$k};
    
  •              $v{"CustomField-".$cf->Id()} = \@cfvalues;
    
  •              delete $data{$k};
    
  •            }
           }
           elsif (lc $k eq 'text') {
               $text = delete $data{$k};
    

I’m assuming that the differente values will come separated by simple comma ‘,’, as this is the way it works on edition. I know this could lead to bad behaviours if any of the values has any comma, so in my own implementation I’m using whitespace&comma&whitespace.

I don’t know whether this could be included in future versions of RT, but I want to share it just in case someone finds it useful.

Cheers!

Iñaki de Eguía Díez
Desarrollador - Entornos Abiertos
inaki.deeguia@csa.esmailto:inaki.deeguia@csa.es

En cumplimiento de la Ley Orgánica 15/1999, de 13 de diciembre, de Protección de Datos de Carácter Personal, los datos personales reflejados en este documento se incluirán en una base de datos informatizada de titularidad de Centro Regional de Servicios Avanzados, S.A. Dicha base de datos se encuentra inscrita en el Registro General de Protección de Datos conforme a lo dispuesto en la legislación vigente y cumpliendo todas las medidas de seguridad del Real Decreto 994/1999, de 11 de junio, de medidas de seguridad de los ficheros automatizados que contengan datos de carácter personal. Asimismo, el cliente dispone en todo momento de los derechos de información, acceso, rectificación, cancelación y oposición, que podrá ejercitar por escrito mediante carta dirigida al Responsable de Seguridad, en la siguiente dirección: C/ López Bravo, 1. 09001 Burgos (España).