[rt-users] CLI - Line Breaks for body

Chris Black chrisb at webreachinc.com
Thu Sep 14 16:26:52 EDT 2006


Hi, I haven't attempted to use this CLI command before, but when I  
try now I get:

[root at felwood rt]$ ./bin/rt comment -m "this is a test\n test" 5242
Password:
rt: Server error: Not Found (404)

Any ideas on that?

I currently do it using this script:
#!/usr/bin/perl -w

use lib "/usr/local/rt/lib";
use lib "/usr/local/rt/etc";

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;

         $queue = $ARGV[0];
         $requestor = $ARGV[1];
         $subject = $ARGV[2];
         $body = $ARGV[3];
         $client = $ARGV[4];
         $contact = $ARGV[5];
         $impact = $ARGV[6];
         $phi = $ARGV[7];
         $source = $ARGV[8];
         $category = $ARGV[9];
         $severity = $ARGV[10];
         my $ticket = new RT::Ticket($CurrentUser);
         my $ticket_body = MIME::Entity->build(Data => $body,
                 Type => 'text/plain');

         my %ticket_vals = ( Queue => $queue,
                 Subject => $subject,
                 Owner => '',
                 Requestor => $requestor,
                 InitialPriority => '11',
                 FinalPriority => '20',
                 MIMEObj => $ticket_body,
                 'CustomField-2' => $client,
                 'CustomField-14' => $contact,
                 'CustomField-21' => $impact,
                 'CustomField-10' => $phi,
                 'CustomField-26' => $source,
                 'CustomField-20' => $category,
                'CustomField-15' => $severity,
         );
         my ($id, $transaction_object, $err) = $ticket->Create(% 
ticket_vals);
         print STDERR $err . "\n" if $err;


Thanks,
Cj B


On Sep 14, 2006, at 1:12 PM, Frank Pater wrote:

> Hi Cj,
>
> We were unable to get the text attribute of 'rt create -t ticket'  
> to accept newlines on the CLI. The -m flag to 'rt comment' accepts  
> them, though. We used this 2-step process to create our tickets  
> with existing data.
>
> Sincerely,
> Frank Pater
> DCANet
> http://www.dca.net
> voice: 888-4-DCANET (888-432-2638)
> fax: 302-426-6386
>
> On Thu, Sep 14, 2006 at 12:50:49PM -0700, Chris Black wrote:
>> Hi, I need to use the CLI to create tickets, however I'm having
>> issues submitting line breaks in the body. How do you indicate a line
>> break to RT through the CLI. I'm using the script in this example:
>> http://wiki.bestpractical.com/index.cgi?CliBasics
>>
>> Thanks,
>> Cj B
>> _______________________________________________
>> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>>
>> 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




More information about the rt-users mailing list