AutoCcLastOwner

From Request Tracker Wiki
Revision as of 16:03, 6 April 2016 by Admin (talk | contribs) (2 revisions imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

AutoCcLastOwner

This scrip adds the previous owner of a ticket to the Cc list when the owner is changed.

Description: AutoCcOwner
Condition: On Owner Change
Action: User Defined
Custom action preparation code:
 my $last_id = $self->TransactionObj->OldValue;
 my $temp_user = RT::User->new();
 $temp_user->Load($last_id);
 my $last_email = $temp_user->EmailAddress();
 $self->TicketObj->AddWatcher( Type => "Cc",
                             Email => $last_email);
 return 1;

Custom action cleanup code:
 return 1;
Template: Global template: Blank

Automatically AdminCc last owner when owner changes to Nobody

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.

Custom action preparation code:

# only act if the owner was changed to "Nobody"
 my $new_id = $self->TransactionObj->NewValue;
 return 1 unless ($new_id == $RT::Nobody->Id);
 
 # add the previous owner to the AdminCc list
 my $last_id = $self->TransactionObj->OldValue;
 my $temp_user = RT::User->new();
 $temp_user->Load($last_id);
 my $last_email = $temp_user->EmailAddress();
 $self->TicketObj->AddWatcher( Type => "AdminCc",
                             Email => $last_email);
 return 1;