Hi list,<div><br></div><div>Hi try to create a scrip which will create a new ticket in an other queue, with the last comment as body.</div><div><br></div><div>Description :  On close Create ticket in alerts</div><div>Condition : On close</div>
<div>Action : Defined by user</div><div>Modèle : null</div><div>Step : TransactionCreate</div><div><br></div><div>Pre-action code: </div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>return 1;</div>
</blockquote><br></div><div>Custom action :</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>my $ticket = $self->TicketObj;</div></div><div><div>my $CF = $ticket->FirstCustomFieldValue('VALIDATION');</div>
</div><div><div>my $child_ticket = RT::Ticket->new ( $RT::SystemUser );</div></div><div><div>my $queue_name = 'Alerts';</div></div><div>return 0 if ($CF ne $queue_name );</div><div><br></div><div><div>my $transactions = $ticket->Transactions;</div>
<div>$transactions->Limit( FIELD => 'Type', VALUE => 'Comment' );</div><div><br></div><div>while (my $transaction = $transactions->Next){</div><div>     $RT::Logger->info("Transaction ". $transaction->id);</div>
<div>     my $attachments = $transaction->Attachments;</div><div>     while (my $attachment = $attachments->Next) {</div><div>        $RT::Logger->info("Attachment". $attachment->id);</div><div>        my $content = $attachment->ContentAsMIME;</div>
<div>     }</div><div>}</div></div><div><br></div><div><div>my ($child_id, $child_transobj, $errormsg ) = $child_ticket->Create( </div><div>Queue => $queue_name , </div><div>Subject => $ticket->Subject,</div><div>
RefersTo => $ticket->id ,</div><div>Owner => $ticket->Owner ,</div></div><div><div>MIMEObj   => $Content,</div><div>); </div><div><br></div><div>unless ( $child_id ) { </div><div>$RT::Logger->debug(">>Error : ". $errormsg); </div>
<div>return 0; </div><div>};</div></div><div>return 1;</div><div><br></div></blockquote>So, without the while loop and the MIMEObj parameter, the scrip works fine, and a new ticket is created in the other queue, but with an empty body.<div>
When I add the loop, the scrip fail, and I don't any error log.</div><div><br></div><div>Do you have any idea about this problem ?</div><div><br></div><div>Best regards,</div><div>Anthony</div>