
Hello Dev's, I have been trawling the lists and google to find a
solution to my problem but have been unable to find anything to get me
further than I am.
I found this script on the dev list from a while back and I have been
trying to adapt it to work with OTRS 2.2.3 to create a ticket via perl.
The script is exactly where I need to start to help integrate the OTRS
system into our workflow here.
The script is shown below but the error message when I run it from
/opt/otrs/bin/CreateTickets2-n.pl is:
[853232650@localhost bin]$ pwd
/opt/otrs/bin
[853232650@localhost bin]$ ./CreateTicket2-n.pl
Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT>
line 4.
-rwxrwxr-x 1 apache apache 2657 Nov 22 21:27 CreateTicket2-n.pl
I am sure the thing I am missing is very simple but I am at a loss as to
where to proceed. The CVS public API seems very straight forward but I
cant get past the very basic point where I am. Any pointers as to how
to create a basic ticket with article from Perl using the API would be
very appreciated.
Thanks for your help
#!/usr/bin/perl -w
# --
# create ticket with an article
# Copyright (C)
# --
# $Id: otrs.addUser,v 1.8 2003/03/06 22:11:59 martin Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
# --
use File::Basename;
use FindBin qw($RealBin);
use lib dirname($RealBin);
use lib dirname($RealBin)."/Kernel/cpan-lib";
use Kernel::Config;
use Kernel::System::Time;
use Kernel::System::Log;
use Kernel::System::DB;
use Kernel::System::Ticket;
my $ConfigObject = Kernel::Config->new();
my $TimeObject = Kernel::System::Time->new(
ConfigObject => $ConfigObject,
);
my $LogObject = Kernel::System::Log->new(
ConfigObject => $ConfigObject,
LogPrefix => "CreateTicket.pl",
);
my $DBObject = Kernel::System::DB->new(
ConfigObject => $ConfigObject,
LogObject => $LogObject,
);
my $TicketObject = Kernel::System::Ticket->new(
ConfigObject => $ConfigObject,
LogObject => $LogObject,
DBObject => $DBObject,
TimeObject => $TimeObject,
);
my $TicketID = $TicketObject->TicketCreate(
TN => $TicketObject->TicketCreateNumber(),
Queue => 'Raw',
Lock => 'unlock',
GroupID => 1,
Priority => '3 normal',
State => 'new',
CustomerNo => '',
CustomerUser => '',
UserID => 1, # current owner
CreateUserID => 1,
);
print "Ticket (TicketID:$TicketID) created.\n";
if ($TicketID) {
my $ArticleID = $TicketObject->ArticleCreate(
TicketID => $TicketID,
ArticleType => 'note-external', #
email-external|email-internal|phone|fax|...
SenderType => 'customer', # agent|system|customer
From => 'Some Agent
Security Monitoring and Compliance Infrastructure Security Services RBC Royal Bank of Canada Tel: 416-348-4429
_______________________________________________________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.