[rt-users] copy a ticket with a script - problem with

Marco.deSousa at billag.com Marco.deSousa at billag.com
Wed Aug 18 02:48:21 EDT 2010


Hello,

I have a problem, have a queue with tickets, when they are resolved status i want to
clone the ticket and dispatch the clone to another queue: RT-Test2_IdeeManag
The clone don't have personnal infos like Requestor or Owner,
the original ticket will be archived.

I wrote a script, and i work good, but i just have a problem with the ticket
comment, was empty.

$self->TransactionObj->Content;  have the tickets comments, but  only work "On Create"

On Resove, i think the TransactionObj is empty...

Of course i try to copy this Content with this code:
$self->TicketObj->Comment->MIMEObj

I is possible to read ticket comment: $self->TicketObj->Comment ?

Tanks,
Best regards.

Marco



My script:
*********************************************************************************
Custom Condition:
-----------------------------------------------------------------------------------------------------
return 0 unless $self->TransactionObj->Type eq "Status";
return 0 unless $self->TransactionObj->NewValue eq "resolved";
return 1;

Custom Action Preperation Code:
------------------------------------------------------------------------------------------------------
require MIME::Entity;

my $trans = $self->TransactionObj;
my $tkt = $self->TicketObj;


my $requestors = [ $tkt->Requestors->MemberEmailAddresses ];

my $cont = $tkt->Comment->MIMEObj;       ****this line don't work****
my $line = $tkt->Subject;

my $new_tkt = RT::Ticket->new($RT::SystemUser);
my ($id, $msg) = $new_tkt->Create(
                  Queue => "RT-Test2_IdeeManag",
                  Subject => $line,
                  Status => 'open',
                  Requestor => 'xxx at mydomain.ch',
                  DependedOnBy => $tkt->Id,
                  MIMEObj => MIME::Entity->build(
                    Type => 'text/plain',
                    Data => $cont)

);

return 1;
********************************************************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20100818/51aac7cf/attachment.htm>


More information about the rt-users mailing list