Manipulate correspond content in history

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

thanks

Woody.

Richard Wood (Woody)
Managing Director
Wild Thing Safaris Ltd.

UK: 2B Habbo St, Greenwich, London
Dar es Salaam: 5 Ethan St, Mbezi beach
Arusha: 3 Ebeneezer Rd, Njiro
PO BOX 34514 DSM
Office: +255 (0) 222 617 166
Office Mobile: +255 (0) 773 503 502
Direct: +255 742 373 327
Skype: woody1tz

Hi Woody,On Fri, Aug 19, 2016 at 7:26 AM, Woody - Wild Thing Safaris woody@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 :slight_smile:

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

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.

This is what the “Show” link next to the “Outgoing email recorded”
button is for.

$self->TransactionObj->ContentObj->SetContent($content);

no errors, but the content is not changed

All ->Set… methods return a tuple of ($success, $msg). You’ll find
that $success is false, and $msg is telling you that the field is
read-only.

RT views attachments as effectively immutable. Changing this invariant
is complex, and not generally recommended.

  • Alex

Hi Matt,

thanks. Totally out of my depth. At least I know to give up on that one!

w.On 19/08/16 15:49, Matt Zagrabelny wrote:

Hi Woody,

On Fri, Aug 19, 2016 at 7:26 AM, Woody - Wild Thing Safaris woody@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 :slight_smile:

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

Richard Wood (Woody)
Managing Director
Wild Thing Safaris Ltd.

UK: 2B Habbo St, Greenwich, London
Dar es Salaam: 5 Ethan St, Mbezi beach
Arusha: 3 Ebeneezer Rd, Njiro
PO BOX 34514 DSM
Office: +255 (0) 222 617 166
Office Mobile: +255 (0) 773 503 502
Direct: +255 742 373 327
Skype: woody1tz