Hi,
I am trying to write a script to open an RT ticket and then send correspondence using an article.
I have the following, which works.
#!/usr/bin/env perl
use warnings;
use strict;
use RT::Client::REST;
use RT::Client::REST::Ticket;
my $rt = RT::Client::REST->new( server => 'https://rt.example.org', timeout => 30 );
$rt->login( username => 'user1', password => 'password123' ) or die "problem logging in: ", shift->message;
my @requestor;
push(@requestor, 'John Smith <john.smith@example.org>');
my $ticket = RT::Client::REST::Ticket->new(
rt => $rt,
queue => 'example',
subject => 'Welcome!',
owner => 'user1',
status => 'open',
requestors => \@requestor,
cf => {
'Username' => 'jsmith',
'OneTimePassword' => 'welcome123',
},
)->store( text => 'Ticket for new user jsmith.' );
print "TICKET CREATED: " . $ticket->id . "\n";
$ticket->comment( message => 'Here is a comment on this ticket.' );
$ticket->correspond( message => 'I am replying to this ticket.' );
This opens a new ticket, populating it with custom fields and sends a comment and a reply. However, I want to use an article for the contents of the correspondence. In the RT web GUI, when composing a reply, one can just select the article from the ‘Include Article:’ pop up menu and then click ‘Update Ticket’.
Can this be done with RT::Client::REST, or is there a different way to do it?
Thank you!