Hi,

I'd trying to create a ticket with custom field value using cli interface,
but it hasn't supported yet :(.  The other solution is RT API, isn't it?

I've developed the following snippet code for create a simple ticket.

#!/usr/bin/perl -w

use lib ("/usr/local/rt3.0/lib");

use RT::Interface::CLI;
use RT;
RT::LoadConfig();
RT::Init();
use RT::Ticket;
use RT::CurrentUser;
my $CurrentUser = RT::Interface::CLI::GetCurrentUser();
use MIME::Entity;

my $ticket = new RT::Ticket($CurrentUser);

my $ticket_body = MIME::Entity->build(Data => 'Body Mesage', Type =>
'text/plain');

my %ticket_vals = ( Queue => 'suporte',
                   Subject => 'test',
                   Owner => 'root',
                   Requestor => '[EMAIL PROTECTED]',
                   InitialPriority => '11',
                   FinalPriority => '20',
                   MIMEObj => $ticket_body,
                 );

my ($id, $transaction_object, $err) = $ticket->Create(%ticket_vals);
print STDERR $err . "\n" if $err;


But, It isn't run correctly, I've gotten this errors:

[Wed Jul 11 21:23:55 2007] [crit]: RT::Attachment->Create couldn't, as
you didn't specify a transaction
(/usr/local/rt3.0/lib/RT/Attachment_Overlay.pm:117)
[Wed Jul 11 21:23:55 2007] [err]: RT::Scrips=HASH(0x9434c88) couldn't
load ticket 16
(/usr/local/rt3.0/lib/RT/Scrips_Overlay.pm:143)
[Wed Jul 11 21:23:55 2007] [crit]: Trying to check RT::Queue rights
for an unspecified RT::Queue
(/usr/local/rt3.0/lib/RT/Principal_Overlay.pm:355)
[Wed Jul 11 21:23:55 2007] [error]: Ticket couldn't be created:
(/usr/local/rt3.0/lib/RT/Ticket_Overlay.pm:648)
O tíquete não pôde ser criado devido a um erro interno


Does anyone know what is wrong?
What is snippet code I have to add in this code to populate custom field?


PS: I am trying to integrate RT with Nagios.


Thanks,
--
Marco Catunda
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Reply via email to