[rt-users] CreateTickets action fails to execute template

sam.howard at gmxtechnologies.com sam.howard at gmxtechnologies.com
Thu Dec 8 16:54:15 EST 2005


Hi.

On RT 3.4.4 (debian based), we are trying to create a scrip/template 
combination that will open tickets and relate them back to a master 
ticket based on the settings of various custom fields.

I _had_ this working yesterday, and now I can't figure out why it 
doesn't work now!

Here's the actions and symptoms I see:

 * Ticket gets modified
 * Scrip with User Defined condition fires
  * Scrip condition checks out and "return 1;"s
 * CreateByTemplate logs to the debug file

And then nothing.

What I DO NOT see is the Template being executed.  The first line of 
code in the template logs to the debug file, and that never shows up!

If I change the Action to "Notify Owner", the template gets executed and 
I get an e-mail with the ===Create-Ticket stuff in it.

What could be causing the "Create Tickets" action to fail to execute the 
template???  I've looked in CreateTickets.pm, but don't see anything in 
there that tips me off.  I put a debug line in Parse, and I see it 
enters Parse, but I never see the template execution debugging, so I'm 
completely at a loss.

Help!  I'm almost out of hair to rip out!!

**** Debug log: ****

[Thu Dec  8 21:41:09 2005] [debug]: About to commit scrips for 
transaction #17171 
(/usr/share/request-tracker3.4/lib/RT/Transaction_Overlay.pm:169)
[Thu Dec  8 21:41:09 2005] [debug]: Found 1 scrips 
(/usr/share/request-tracker3.4/lib/RT/Scrips_Overlay.pm:356)
[Thu Dec  8 21:41:09 2005] [debug]: In scrip Subtask Manager - 
ChangeTicket ((eval 412):1)
[Thu Dec  8 21:41:09 2005] [debug]: Subtask Manager - ChangeTicket - 
Trans Type: CustomField ((eval 412):7)
[Thu Dec  8 21:41:09 2005] [debug]: Subtask Manager - ChangeTicket - GO! 
((eval 412):9)
[Thu Dec  8 21:41:09 2005] [debug]: In CreateByTemplate 
(/usr/share/request-tracker3.4/lib/RT/Action/CreateTickets.pm:561)

**** Scrip configuration: ****

Description: Subtask Manager - ChangeTicket
Condition: User Defined
Action: Create Tickets
Template: Subtask Manager
Stage: TransactionBatch  (which is enabled)

**** Scrip custom condition: ****

$RT::Logger->debug("In scrip Subtask Manager - ChangeTicket");

my $ticket = $self->TicketObj;
my @batch = @{$ticket->TransactionBatch};

foreach my $txn (@batch) {
  $RT::Logger->debug("Subtask Manager - ChangeTicket - Trans Type: " . 
$txn->Type);
  if ($txn->Type eq 'CustomField') {
    $RT::Logger->debug("Subtask Manager - ChangeTicket - GO!");
    return 1;
  }
}

$RT::Logger->debug("Subtask Manager - ChangeTicket - Does Not Apply");
return 0;

**** Template - Subtask Manager **** Never seems to get executed with 
Action: Create Tickets because I never see the first logging line

{
  $RT::Logger->debug("Subtask Manager - ChangeTicket - Starting...");

  my @batch = @{$Ticket->TransactionBatch};
 
  foreach my $txn(@batch) {
    $RT::Logger->debug("Subtask Manager - ChangeTicket - Trans Type: " . 
$txn->Type);
    if (($txn->Type eq 'CustomField') &&
        ($txn->NewValue eq 'Required')) {

      # Get the Custom Field name
      my $cf = RT::CustomField->new($Ticket->CurrentUser());
      $cf->Load($txn->Field);
      my $field = $cf->Name();

      # Create the Subject line for the individual sub-tickets
      my $subject = $Transaction->Subject || $Ticket->Subject;
      $subject =~ s/MASTER/$field/ie;

      $RT::Logger->debug("Subtask Manager - ChangeTicket - Creating 
Ticket for ", $subject);

      $Ticket->Comment(Content => 'Created subtask ticket for ' . $field);

      $OUT .= '===Create-Ticket: ' . $field . "\n";
      $OUT .= 'Queue: ' . $field . "\n";
      $OUT .= 'Subject: ' . $subject . "\n";
      $OUT .= 'Requestor: ' . $Ticket->OwnerObj->EmailAddress() . "\n";
      $OUT .= 'RefersTo: ' . $Ticket->id . "\n";
      $OUT .= 'Content: ' . $Ticket->Transactions->First->Content() . "\n";
      $OUT .= "ENDOFCONTENT\n";
    }
  }

  $RT::Logger->debug("Template output", $OUT);

  $OUT;
}



More information about the rt-users mailing list