<?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=AutoCcLastOwner</id>
	<title>AutoCcLastOwner - 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=AutoCcLastOwner"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=AutoCcLastOwner&amp;action=history"/>
	<updated>2026-08-21T19:04: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=AutoCcLastOwner&amp;diff=222&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=AutoCcLastOwner&amp;diff=222&amp;oldid=prev"/>
		<updated>2016-04-06T20:03:16Z</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;=== AutoCcLastOwner ===&lt;br /&gt;
&lt;br /&gt;
This scrip adds the previous owner of a ticket to the Cc list when the owner is changed.&lt;br /&gt;
&lt;br /&gt;
 Description: AutoCcOwner&lt;br /&gt;
 Condition: On Owner Change&lt;br /&gt;
 Action: User Defined&lt;br /&gt;
 Custom action preparation code:&lt;br /&gt;
  my $last_id = $self-&amp;amp;gt;TransactionObj-&amp;amp;gt;OldValue;&lt;br /&gt;
  my $temp_user = RT::User-&amp;amp;gt;new();&lt;br /&gt;
  $temp_user-&amp;amp;gt;Load($last_id);&lt;br /&gt;
  my $last_email = $temp_user-&amp;amp;gt;EmailAddress();&lt;br /&gt;
  $self-&amp;amp;gt;TicketObj-&amp;amp;gt;AddWatcher( Type =&amp;amp;gt; &amp;quot;Cc&amp;quot;,&lt;br /&gt;
                              Email =&amp;amp;gt; $last_email);&lt;br /&gt;
  return 1;&lt;br /&gt;
 &lt;br /&gt;
 Custom action cleanup code:&lt;br /&gt;
  return 1;&lt;br /&gt;
 Template: Global template: Blank&lt;br /&gt;
&lt;br /&gt;
=== Automatically AdminCc last owner when owner changes to Nobody ===&lt;br /&gt;
&lt;br /&gt;
When someone moves tickets between queues, the owner may forcibly get changed to Nobody, and then the previous owner loses access to the ticket. This variant of the above scrip will detect this situation and automatically add that previous owner as an [[AdminCc]].&lt;br /&gt;
&lt;br /&gt;
Custom action preparation code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;# only act if the owner was changed to &amp;quot;Nobody&amp;quot;&lt;br /&gt;
 my $new_id = $self-&amp;amp;gt;TransactionObj-&amp;amp;gt;NewValue;&lt;br /&gt;
 return 1 unless ($new_id == $RT::Nobody-&amp;amp;gt;Id);&lt;br /&gt;
 &lt;br /&gt;
 # add the previous owner to the AdminCc list&lt;br /&gt;
 my $last_id = $self-&amp;amp;gt;TransactionObj-&amp;amp;gt;OldValue;&lt;br /&gt;
 my $temp_user = RT::User-&amp;amp;gt;new();&lt;br /&gt;
 $temp_user-&amp;amp;gt;Load($last_id);&lt;br /&gt;
 my $last_email = $temp_user-&amp;amp;gt;EmailAddress();&lt;br /&gt;
 $self-&amp;amp;gt;TicketObj-&amp;amp;gt;AddWatcher( Type =&amp;amp;gt; &amp;quot;AdminCc&amp;quot;,&lt;br /&gt;
                             Email =&amp;amp;gt; $last_email);&lt;br /&gt;
 return 1;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>