Setting Transaction Custom fields from CLI

I’ve been working with RT 3.4.4 and I have been tasked with creating a Perl
script that runs from the command line and updates tickets. One of the
options I would like to set is a custom field attached to
comment/correspondence (transactions). The problem is I have absolutely no
idea how to tell RT to attach those custom field values to the comment that
goes along with it. I can get the comment to show up in RT, I can get the
custom field value to show up in the DB. But I’m not sure how to get them
both to show up together in RT.

I’m using this bit of code to add a new comment:

my $ticket_comment = MIME::Entity->build(Data => $opt_a,

Type => ‘text/plain’);

my %comment = ( MIMEObj => $ticket_comment );

my ($id, $transaction_object, $err) = $ticket->Comment(%comment);

So my question is if there is a way to add the custom field value to the
$ticket->Comment call so that it gets associated with that comment?

  • Spiker

I’ve been working with RT 3.4.4 and I have been tasked with creating a Perl
script that runs from the command line and updates tickets. One of the
options I would like to set is a custom field attached to
comment/correspondence (transactions). The problem is I have absolutely no
idea how to tell RT to attach those custom field values to the comment that
goes along with it. I can get the comment to show up in RT, I can get the
custom field value to show up in the DB. But I’m not sure how to get them
both to show up together in RT.

I’m using this bit of code to add a new comment:

my $ticket_comment = MIME::Entity->build(Data => $opt_a,

Type => ‘text/plain’);

my %comment = ( MIMEObj => $ticket_comment );

my ($id, $transaction_object, $err) = $ticket->Comment(%comment);

So my question is if there is a way to add the custom field value to the
$ticket->Comment call so that it gets associated with that comment?
Comment is Transaction with Attachments and if your RT version(don’t
remember when it was implemented) has support for CFs on the
Transactions then you can do that. See RT::Record’s docs.

  • Spiker

The rt-users Archives

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

Buy your copy of our new book, RT Essentials, today!

Download a free sample chapter from
http://rtbook.bestpractical.com

Best regards, Ruslan.