<?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=UseRtTool</id>
	<title>UseRtTool - 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=UseRtTool"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=UseRtTool&amp;action=history"/>
	<updated>2026-08-23T02:59:15Z</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=UseRtTool&amp;diff=4104&amp;oldid=prev</id>
		<title>Admin: 6 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=UseRtTool&amp;diff=4104&amp;oldid=prev"/>
		<updated>2016-04-06T20:39:39Z</updated>

		<summary type="html">&lt;p&gt;6 revisions imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:39, 6 April 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-4103:rev-4104 --&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=UseRtTool&amp;diff=4103&amp;oldid=prev</id>
		<title>81.56.192.64: /* Custom Fields */</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=UseRtTool&amp;diff=4103&amp;oldid=prev"/>
		<updated>2012-09-11T16:49:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Custom Fields&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== bin/rt/ command line tool ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$RTHOME/bin/rt&amp;#039;&amp;#039;&amp;#039; is a command line tool that comes with RT. &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; can be useful for automating certain RT-related activities: making custom reports, pulling data to feed to other processes, making mass changes to tickets (be careful!), etc. It can both query and update the RT database. &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; has its limitations; it cannot deal with custom fields yet (as of January, 2006).&lt;br /&gt;
&lt;br /&gt;
There is no POD (Plain Old Documentation) for the &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; tool, but &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; has many help pages available by typing &amp;lt;code&amp;gt; bin/rt help&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Telling /bin/rt how to connect ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; talks to your RT web site (not directly to the database) and it needs to know how to connect as if it were a user using a web browser. You can provide connection information either via environment variables or via a configuration file. Define RTUSER to be the RT user name and RTSERVER to be the base URL of your RT web site. E.g.:&lt;br /&gt;
&lt;br /&gt;
 export RTUSER=kevin&lt;br /&gt;
 export RTSERVER=http://127.0.0.1/rt&lt;br /&gt;
&lt;br /&gt;
(syntax is for Bourne-type UNIX shells).&lt;br /&gt;
&lt;br /&gt;
Or create /.rtrc in your home directory and place lines in it like this:&lt;br /&gt;
&lt;br /&gt;
 server http://your.rt.server/your_rt_url_path&lt;br /&gt;
 user   YOUR_RT_USERNAME&lt;br /&gt;
 passwd YOUR_RT_PASSWORD&lt;br /&gt;
&lt;br /&gt;
By default, &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; assumes a server of http://localhost/rt and the same user name as the currently logged-in operating system user.&lt;br /&gt;
&lt;br /&gt;
The user defined above must be a privileged user in your RT instance, i.e. a user who can be granted rights and who has a password. If you don&amp;#039;t specify a user, then the operating system user who executes the &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; command is used; in this case, the operating system user must also be defined as a privileged user in RT, and the /unix login/ field for that user should be set to the name of the operating system user also. For example, you could have an operating system user named /rt/ and an RT user named /rt/ whose /unix login/ is also /rt/.&lt;br /&gt;
&lt;br /&gt;
Remember that any queries and modifications you perform with the &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; command are limited by the permissions of the RT user identity used.&lt;br /&gt;
&lt;br /&gt;
If your web server authenticates in addition to RT itself, place the web server authentication in your server URL, e.g.: http://user:[mailto:pass@server pass@server]/rt.&lt;br /&gt;
&lt;br /&gt;
=== Using bin/rt ===&lt;br /&gt;
&lt;br /&gt;
Until someone feels like updating this wiki page, refer to the usage documentation available by typing &amp;lt;code&amp;gt; bin/rt help&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
* Display all tickets in Queue number 3 where there is no due date and the ticket isn&amp;#039;t closed.&lt;br /&gt;
&lt;br /&gt;
 bin/rt ls -o -Created -t ticket &amp;quot;Queue = &amp;#039;3&amp;#039; and due = &amp;#039;Not set&amp;#039;  \&lt;br /&gt;
     AND Status != &amp;#039;resolved&amp;#039; AND Status != &amp;#039;rejected&amp;#039; &amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Custom Fields ===&lt;br /&gt;
&lt;br /&gt;
It turns out that bin/rt CAN handle custom fields, but like all things RT, you must ask properly!&lt;br /&gt;
&lt;br /&gt;
1. If your Custom Field Name contains spaces use single quotes around it for bin/rt to work. Otherwise if you don&amp;#039;t use spaces in your Custom Field Names then single quotes are not necessary.&lt;br /&gt;
&lt;br /&gt;
2. The user (as in &amp;quot;export RTUSER=yourname&amp;quot;) must have the ability to update custom fields.&lt;br /&gt;
&lt;br /&gt;
3. You must specify the custom field name EXACTLY as it is shown in &amp;quot;rt show ticket/123&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If you get any of the above wrong, RT will simply ignore the set command with no feedback.&lt;br /&gt;
&lt;br /&gt;
So with this result from an &amp;#039;rt show ticket/123&amp;quot; command (on any ticket):&lt;br /&gt;
&lt;br /&gt;
 CF-TaskType: Project Task&lt;br /&gt;
&lt;br /&gt;
The following create code example works fine:&lt;br /&gt;
&lt;br /&gt;
 rt create -t ticket set subject=&amp;#039;do a bunch of stuff&amp;#039; set CF-TaskType=&amp;#039;Project Task&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I use the above routinely in RT v3.6.3&lt;br /&gt;
&lt;br /&gt;
 - Ron (rtmaster@standsure.com) 22-May-2008&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And the following create code example works fine, using a Custom Field Name with spaces and single quotes:&lt;br /&gt;
&lt;br /&gt;
 rt create -t ticket set subject=&amp;#039;do a bunch of stuff&amp;#039; set CF-&amp;#039;Task Type&amp;#039;=&amp;#039;Project Task&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 - Noopy 06-Oct-2011&lt;br /&gt;
Note that you can also use the CF&amp;#039;s number (this is a lifesaver when CF are named with accents and/or quotes):&lt;br /&gt;
 rt create -t ticket set CF-28=&amp;#039;Here is a new value&amp;#039;&lt;br /&gt;
&lt;br /&gt;
 - TheFreeCat 11-Sept-2012&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
&lt;br /&gt;
* A more complicated but much more flexible alternative to using &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; is to write a Perl script using the RT API. See [[ObjectModel]] and [[CliBasics]] for some preliminaries.&lt;br /&gt;
&lt;br /&gt;
* Query arguments to &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; are written in [[TicketSQL]].&lt;br /&gt;
&lt;br /&gt;
* For mass updates, you can do things like this:&lt;br /&gt;
&lt;br /&gt;
 bin/rt list -i &amp;quot;Queue = &amp;#039;testqueue&amp;#039;&amp;quot; | bin/rt edit - set status=resolved&lt;br /&gt;
&lt;br /&gt;
* For complicated updates, you may have to write a script to grab the details of all the relevant tickets, figure out what changes are required, then execute the required &amp;#039;rt edit&amp;#039; commands to make the changes.&lt;br /&gt;
&lt;br /&gt;
* Certain fields have special constraints. For instance, it is not possible to directly set a ticket owner; the ticket must first be assigned to the modifying user, /then/ to the final desired owner name.&lt;/div&gt;</summary>
		<author><name>81.56.192.64</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=UseRtTool&amp;diff=4100&amp;oldid=prev</id>
		<title>207.126.99.66: /* Custom Fields */</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=UseRtTool&amp;diff=4100&amp;oldid=prev"/>
		<updated>2011-10-06T15:55:29Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Custom Fields&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== bin/rt/ command line tool ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$RTHOME/bin/rt&amp;#039;&amp;#039;&amp;#039; is a command line tool that comes with RT. &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; can be useful for automating certain RT-related activities: making custom reports, pulling data to feed to other processes, making mass changes to tickets (be careful!), etc. It can both query and update the RT database. &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; has its limitations; it cannot deal with custom fields yet (as of January, 2006).&lt;br /&gt;
&lt;br /&gt;
There is no POD (Plain Old Documentation) for the &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; tool, but &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; has many help pages available by typing &amp;lt;code&amp;gt; bin/rt help&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Telling /bin/rt how to connect ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; talks to your RT web site (not directly to the database) and it needs to know how to connect as if it were a user using a web browser. You can provide connection information either via environment variables or via a configuration file. Define RTUSER to be the RT user name and RTSERVER to be the base URL of your RT web site. E.g.:&lt;br /&gt;
&lt;br /&gt;
 export RTUSER=kevin&lt;br /&gt;
 export RTSERVER=http://127.0.0.1/rt&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
(syntax is for Bourne-type UNIX shells).&lt;br /&gt;
&lt;br /&gt;
Or create /.rtrc/ in your home directory and place lines in it like this:&lt;br /&gt;
&lt;br /&gt;
 server http://your.rt.server/your_rt_url_path&lt;br /&gt;
 user   YOUR_RT_USERNAME&lt;br /&gt;
 passwd YOUR_RT_PASSWORD&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
By default, &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; assumes a server of http://localhost/rt and the same user name as the currently logged-in operating system user.&lt;br /&gt;
&lt;br /&gt;
The user defined above must be a privileged user in your RT instance, i.e. a user who can be granted rights and who has a password. If you don&amp;#039;t specify a user, then the operating system user who executes the &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; command is used; in this case, the operating system user must also be defined as a privileged user in RT, and the /unix login/ field for that user should be set to the name of the operating system user also. For example, you could have an operating system user named /rt/ and an RT user named /rt/ whose /unix login/ is also /rt/.&lt;br /&gt;
&lt;br /&gt;
Remember that any queries and modifications you perform with the &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; command are limited by the permissions of the RT user identity used.&lt;br /&gt;
&lt;br /&gt;
If your web server authenticates in addition to RT itself, place the web server authentication in your server URL, e.g.: http://user:[mailto:pass@server pass@server]/rt.&lt;br /&gt;
&lt;br /&gt;
=== Using bin/rt ===&lt;br /&gt;
&lt;br /&gt;
Until someone feels like updating this wiki page, refer to the usage documentation available by typing &amp;lt;code&amp;gt; bin/rt help&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Examples ===&lt;br /&gt;
&lt;br /&gt;
* Display all tickets in Queue number 3 where there is no due date and the ticket isn&amp;#039;t closed.&lt;br /&gt;
&lt;br /&gt;
 bin/rt ls -o -Created -t ticket &amp;quot;Queue = &amp;#039;3&amp;#039; and due = &amp;#039;Not set&amp;#039;  \&lt;br /&gt;
     AND Status != &amp;#039;resolved&amp;#039; AND Status != &amp;#039;rejected&amp;#039; &amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Custom Fields ===&lt;br /&gt;
&lt;br /&gt;
It turns out that bin/rt CAN handle custom fields, but like all things RT, you must ask properly!&lt;br /&gt;
&lt;br /&gt;
1. If your Custom Field Name contains spaces use single quotes around it for bin/rt to work. Otherwise if you don&amp;#039;t use spaces in your Custom Field Names then single quotes are not necessary.&lt;br /&gt;
&lt;br /&gt;
2. The user (as in &amp;quot;export RTUSER=yourname&amp;quot;) must have the ability to update custom fields.&lt;br /&gt;
&lt;br /&gt;
3. You must specify the custom field name EXACTLY as it is shown in &amp;quot;rt show ticket/123&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If you get any of the above wrong, RT will simply ignore the set command with no feedback.&lt;br /&gt;
&lt;br /&gt;
So with this result from an &amp;#039;rt show ticket/123&amp;quot; command (on any ticket):&lt;br /&gt;
&lt;br /&gt;
 CF-TaskType: Project Task&lt;br /&gt;
&lt;br /&gt;
The following create code examples work fine:&lt;br /&gt;
&lt;br /&gt;
 rt create -t ticket set subject=&amp;#039;do a bunch of stuff&amp;#039; set CF-TaskType=&amp;#039;Project Task&amp;#039;&lt;br /&gt;
 rt create -t ticket set subject=&amp;#039;do a bunch of stuff&amp;#039; set CF-&amp;#039;Task Type&amp;#039;=&amp;#039;Project Task&amp;#039;&lt;br /&gt;
&lt;br /&gt;
I use the above routinely in RT v3.6.3&lt;br /&gt;
&lt;br /&gt;
 - Ron (rtmaster@standsure.com) 22-May-2008&lt;br /&gt;
&lt;br /&gt;
=== Notes ===&lt;br /&gt;
&lt;br /&gt;
* A more complicated but much more flexible alternative to using &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; is to write a Perl script using the RT API. See [[ObjectModel]] and [[CliBasics]] for some preliminaries.&lt;br /&gt;
&lt;br /&gt;
* Query arguments to &amp;#039;&amp;#039;&amp;#039;bin/rt&amp;#039;&amp;#039;&amp;#039; are written in [[TicketSQL]].&lt;br /&gt;
&lt;br /&gt;
* For mass updates, you can do things like this:&lt;br /&gt;
&lt;br /&gt;
 bin/rt list -i &amp;quot;Queue = &amp;#039;testqueue&amp;#039;&amp;quot; | bin/rt edit - set status=resolved&lt;br /&gt;
&lt;br /&gt;
* For complicated updates, you may have to write a script to grab the details of all the relevant tickets, figure out what changes are required, then execute the required &amp;#039;rt edit&amp;#039; commands to make the changes.&lt;br /&gt;
&lt;br /&gt;
* Certain fields have special constraints. For instance, it is not possible to directly set a ticket owner; the ticket must first be assigned to the modifying user, /then/ to the final desired owner name.&lt;/div&gt;</summary>
		<author><name>207.126.99.66</name></author>
	</entry>
</feed>