CopyContentToCF

From Request Tracker Wiki
Revision as of 10:14, 13 October 2017 by Barton (talk | contribs) (→‎Custom action code)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 
);