[rt-users] Automating ticket updates via RT::Client::REST
Eli Boaz
eboaz at icontrol.com
Thu Apr 25 21:50:13 EDT 2013
I've done some searching and perhaps my Google-fu is lacking, but I was wondering if there were any examples of updating tickets via RT::Client::REST::Ticket, aside from the information available on CPAN.
What I'm specifically looking to do is be able to update a custom field and (optionally) add a comment to the case when a defect is updated in a separate system.
I've been able to add/change/delete attributes, but I where am running into problems is adding a comment without sending the email to the admin_cc list, unless I actually delete the admin_cc list before as I'm doing in the test/proof of concept snippet I've copied below.
my @ids = qw/6119/;
my $comment = "This is a test from Perl";
for my $id (@ids) {
my $ticket = RT::Client::REST::Ticket->new(rt => $rt, id => $id);
my @admin_cc = $ticket->admin_cc();
if((scalar @admin_cc) > 0) {
$ticket->delete_admin_cc(@admin_cc);
}
$ticket->comment(message=>$comment);
try {
$ticket->store;
} catch Exception::Class::Base with {
die "Unable to store ticket update", shift->message;
};
}
Thanks in advance,
Eli Boaz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130426/d280a5e0/attachment.htm>
More information about the rt-users
mailing list