[rt-users] Setting custom fields in scripts

Stewart Tranter S.G.Tranter at lboro.ac.uk
Wed Jan 25 06:51:10 EST 2006


Hello,

I am trying to set the category custom field when creating a ticket via 
a script but I'm not having much luck.  I am familiar with how to do 
this for other custom fields:

my $ticket = new RT::Ticket($CurrentUser);
my $ticket_body = MIME::Entity->build(Data => $cgiobj->param("Content"), 
Type => 'text/plain');
my %ticket_vals = ( Queue => $cgiobj->param("Queue"),
                     Status => $cgiobj->param("Status"),
                     'CustomField-8' => $cgiobj->param("Type"),
                     Requestor => $useremail,
                     CC => $cgiobj->param("Cc"),
                     AdminCC => $cgiobj->param("AdminCc"),
                     Subject => $cgiobj->param("Subject"),
                     'CustomField-12' => $cgiobj->param("Submitted"),
                     'CustomField-14' => $cgiobj->param("OS"),
                     MIMEObj => $ticket_body
                   );
my (my $id, my $transaction_object, my $err) = 
$ticket->Create(%ticket_vals);

However, I have no idea how to set the Category custom fields in this 
way.  For example, would it be thus (where CustomField-22 is my 
category-subcategory field):

...<snip>...
'CustomField-22' => $cgiobj->param("Service") . ":" . $cgiobj->param("Job")
...<snip>...

or perhaps thus:

...<snip>...
'CustomField-22' => $cgiobj->param("Service") . "\\" . $cgiobj->param("Job")
...<snip>...

Any help as always is very welcome!  I am running RT 3.5.5.

TIA,

Stewart
------------------------------------------------
Stewart Tranter
Computing Services
Loughborough University

E:  s.g.tranter at lboro.ac.uk
W:  http://www.lboro.ac.uk/computing/
T:  +44 (0) 1509 223719
F:  +44 (0) 1509 223989
------------------------------------------------



More information about the rt-users mailing list