[rt-users] manipulate correspond content in history

Matt Zagrabelny mzagrabe at d.umn.edu
Fri Aug 19 08:49:49 EDT 2016


Hi Woody,

On Fri, Aug 19, 2016 at 7:26 AM, Woody - Wild Thing Safaris
<woody at wildthingsafaris.com> wrote:
> HI all,
>
> My correspond scrip adds a table of CF values to the correspond email from
> the template, and sends to the client. I would like those same changes
> appended to the transaction content that appears in the history, so it
> matches what was sent to the client and we know easily what was sent.
>
> to test i have made a scrip, on correspond, custom action, template blank
>
> action is
>
> my $content = $self->TransactionObj->ContentObj->Content;
> $content .= "SOME OTHER STUFF";
> $self->TransactionObj->ContentObj->SetContent($content);
>
> no errors, but the content is not changed

The Txn already happened and its content is immutable - sort of. That
is, transactions (txns) are the atomic unit of data in RT. Those are
the things that make sure the paper trail exists for all the other
objects (users, tickets, queues, etc.)

That said, there is enough rope to do what you want. I don't know
exactly the procedure because I haven't implemented your use-case.

You'll want to expose the Transaction's parent's _Set method. In a
local module that gets loaded have some code like:

# {{{
# paper-trail auditor backdoor :)
# Needed to change the txn's content
package RT::Transaction;

use strict;
no warnings qw(redefine);

sub _Set {
    my $self = shift;
    $self->SUPER::_Set(@_);
}
# }}}

There may be more steps beyond this, but I think you'll need this at a minimum.

-m



More information about the rt-users mailing list