<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=CliBasics</id>
	<title>CliBasics - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=CliBasics"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=CliBasics&amp;action=history"/>
	<updated>2026-08-23T00:52:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=CliBasics&amp;diff=518&amp;oldid=prev</id>
		<title>Admin: 2 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=CliBasics&amp;diff=518&amp;oldid=prev"/>
		<updated>2016-04-06T20:03:25Z</updated>

		<summary type="html">&lt;p&gt;2 revisions imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Here is some basic Perl code for creating a batch of tickets using the CLI interface to RT. To get the proper numbers for the custom values fields use the &amp;#039;View Source&amp;#039; option when looking at a ticket in the appropriate queue. This is just a quick script, but it should give enough pointers to get you started on creating tickets.&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/perl -w&lt;br /&gt;
&lt;br /&gt;
 use RT::Interface::CLI;&lt;br /&gt;
 use RT;&lt;br /&gt;
 RT::LoadConfig();&lt;br /&gt;
 RT::Init();&lt;br /&gt;
 use RT::Ticket;&lt;br /&gt;
 use RT::CurrentUser;&lt;br /&gt;
 my $CurrentUser = RT::Interface::CLI::GetCurrentUser();&lt;br /&gt;
 &lt;br /&gt;
 use MIME::Entity;&lt;br /&gt;
 &lt;br /&gt;
 $LEASE = &amp;quot;/home/dawsons/rt/leasedata&amp;quot;;  # each line gives info on a ticket to create&lt;br /&gt;
 &lt;br /&gt;
 open(LEASE, &amp;quot;&amp;amp;lt;$LEASE&amp;quot;) || die &amp;quot;Couldn&amp;#039;t open $LEASE: $!&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 while (&amp;amp;lt;LEASE&amp;amp;gt;)&lt;br /&gt;
 {&lt;br /&gt;
   chomp;&lt;br /&gt;
   ($subject, $dept, $replacement, $body, $j) = split(/\t/, $_, 5);&lt;br /&gt;
   print STDERR &amp;quot;Have extra data &amp;#039;$j&amp;#039;\n&amp;quot; if $j;&lt;br /&gt;
   my $ticket = new RT::Ticket($CurrentUser);&lt;br /&gt;
   my $ticket_body = MIME::Entity-&amp;amp;gt;build(Data =&amp;amp;gt; $body,&lt;br /&gt;
                                        Type =&amp;amp;gt; &amp;#039;text/plain&amp;#039;);&lt;br /&gt;
   my %ticket_vals = ( Queue =&amp;amp;gt; &amp;#039;Lease&amp;#039;,&lt;br /&gt;
                       Subject =&amp;amp;gt; $subject,&lt;br /&gt;
                       Owner =&amp;amp;gt; &amp;#039;root&amp;#039;,&lt;br /&gt;
                       Requestor =&amp;amp;gt; &amp;#039;root@augsburg.edu&amp;#039;,&lt;br /&gt;
                       InitialPriority =&amp;amp;gt; &amp;#039;11&amp;#039;,&lt;br /&gt;
                       FinalPriority =&amp;amp;gt; &amp;#039;20&amp;#039;,&lt;br /&gt;
                       MIMEObj =&amp;amp;gt; $ticket_body,&lt;br /&gt;
                       &amp;#039;CustomField-5&amp;#039; =&amp;amp;gt; $dept,&lt;br /&gt;
                       &amp;#039;CustomField-14&amp;#039; =&amp;amp;gt; $replacement&lt;br /&gt;
                     );&lt;br /&gt;
   my ($id, $transaction_object, $err) = $ticket-&amp;amp;gt;Create(%ticket_vals);&lt;br /&gt;
   print STDERR $err . &amp;quot;\n&amp;quot; if $err;&lt;br /&gt;
 &lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>