I’m still trying to wrap my head around the Perl API.
I can create a ticket using the following code:
my $TicketObj = new RT::Ticket( $RT::SystemUser );
$TicketObj->Create( Queue => ‘General’,
Subject => ‘Test Ticket’,
Requestor => $Requestor );
From reading the docs, it looks like the ‘body’ of a ticket is not
stored with the ticket’s record.
Is there a good way to append a few lines stored in a string to a ticket
at the time it is created?
At Monday 2/5/2007 11:58 AM, John Arends wrote:
I'm still trying to wrap my head
around the Perl API.
I can create a ticket using the following code:
my $TicketObj = new RT::Ticket( $RT::SystemUser );
$TicketObj->Create( Queue =>
‘General’,
Subject =>
‘Test Ticket’,
Requestor =>
$Requestor );
From reading the docs, it looks like the ‘body’ of a ticket is not
stored with the ticket’s record.
Is there a good way to append a few lines stored in a string to a ticket
at the time it is created?
John,
Sounds like you’re on the right track. If you look at the Ticket API (
either by running perldoc against Ticket_Overlay.pm, or by looking at
$RTHOME/lib/RT/Ticket_Overlay.pm), you’ll see that the Create method can
take a MIMEObj argument, which is a MIME::Entity object. If you create
one of these objects with your text in its body, you can pass it in to
the Ticket->Create method.
A good example of this is in the CreateTicket method in
$RTHOME/lib/RT/Interface/Web.pm
Steve
Thanks for the help. The following lets me create a ticket:
$body = MIME::Entity->new();
$body->build(
Type => ‘text/plain’,
Data => ‘Test’);
my $TicketObj = new RT::Ticket( $RT::SystemUser );
$TicketObj->Create( Queue => ‘General’,
Subject => ‘Test Ticket2’, Requestor => $Requestor,
MIMEObj => $body);
If you have any suggestions on a better way to do it, I’d love to hear
it, but this at least works.
Stephen Turner wrote: