Difference between revisions of "CopyContentToCF"

From Request Tracker Wiki
Jump to navigation Jump to search
(Created page with "= Overview = This is a work around for the fact that *quote folding* is always active, regardless of whether ticket is just being created. [See my post to the forums about th...")
 
 
Line 24: Line 24:
$CF->LoadByNameAndQueue( Name => 'Problem', Queue => $Ticket->Queue );
$CF->LoadByNameAndQueue( Name => 'Problem', Queue => $Ticket->Queue );


$CF->AddValueForObject( Object => $Ticket, Content => $Transaction->Content );
$CF->AddValueForObject(  
    Object => $Ticket, Content => $Transaction->Content  
);
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 09:14, 13 October 2017

Overview

This is a work around for the fact that *quote folding* is always active, regardless of whether ticket is just being created. [See my post to the forums about this issue](https://forum.bestpractical.com/t/change-quoting-in-forwarded-tickets/32100). Keith Creasy suggested copying the content of the initial transaction into a custom field called Problem. This also has the advantage that the Problem CF can be edited later, as the ticket evolves, which makes it a useful repository for information that you want to see at the top of the ticket.

Basics

  • Conditon: *On Create*
  • Action: *User Defined*
  • Template: *Blank*

Custom action preparation code

1;

Custom action code

my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;
my $CF = RT::CustomField->new( $RT::SystemUser );

$CF->LoadByNameAndQueue( Name => 'Problem', Queue => $Ticket->Queue );

$CF->AddValueForObject( 
    Object => $Ticket, Content => $Transaction->Content 
);