[rt-users] Bulk queue create?

Torsten Brumm torsten.brumm at googlemail.com
Thu Oct 25 04:03:43 EDT 2007


Dont do this directly to the DB, use some RT Rest functions.

Try this both files:

--
#!/usr/bin/perl
use strict;
use warnings;

BEGIN { die "You must define \$RT_HOME\n"
          unless exists $ENV{RT_HOME} };
use lib "$ENV{RT_HOME}/lib";

use RT;
RT::LoadConfig();
RT::Init();

use RT::Interface::CLI qw(GetCurrentUser loc);
use RT::Tickets;

my $CurrentUser = GetCurrentUser();
die loc("No RT user found.\n") unless ($CurrentUser->Id);
die "We need Arguments like Queuename, Description and Mail Address\n"
unless ($#ARGV==2);
my $Queuename=shift @ARGV;
my $Queuedescription=shift @ARGV;
my $Queuemail=shift @ARGV;
my $Queue = RT::Queue->new($CurrentUser);
my
($id,$Message)=$Queue->Create(Name=>$Queuename,Description=>$Queuedescription,CorrespondAddress=>$Queuemail);
if ($id){
        print $Message."\n";
        }
        else{
                print"This is a error!\n$Message\n";
                }
--
called from a shell script:

--
#!/bin/bash
P1=/opt/rt3/local/bin/
U1=/opt/rt3/local/bin/queuelist

while read zeile; do
        set -- $zeile
        echo "Bearbeite Queue: "$1 $2 $3
        /usr/bin/perl ${P1}createqueue.pl $1 $2 $3
done<$U1
--

Try it, its much more secure.

2007/10/24, José de Paula Eufrásio Júnior <jose.junior at mds.gov.br>:
>
> Is it possible? I have 30+ queues to create, is it possible to create
> the queues directly on the database or using a script?
>
> Thanks.
>
> []s
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:
>
> If you sign up for a new RT support contract before December 31, we'll
> take
> up to 20 percent off the price. This sale won't last long, so get in touch
> today.
>     Email us at sales at bestpractical.com or call us at +1 617 812 0745.
>
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>



-- 
MFG

Torsten Brumm

http://www.torsten-brumm.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20071025/4189509a/attachment.htm>


More information about the rt-users mailing list