Version : RT-4.0.19

Hey All,

Running into a slight problem with a new queue I'm attempting to roll out a new 
queue that uses some "pre-canned" template responses using Articles from the 
integrated RTFM system in 4.0.19 now.  I've changed the lifecycle to make the 
open -> resolve a default RESPOND vs COMMENT and that's working.  However, I 
want to send a default template response if the admin forgets to choose an 
article to respond with.  I came up with the following code below for the 
custom codition.  I'm detecting if the ticket has a ReferTo set and then if it 
doesn't return code 1 to that the scrip executes which sends the template, 
otherwise, sets it to 0 so it skips the scrip.

The problem I'm running into is it appears the run the scrip prior to linking 
the article to ticket, so it always thinks the admin hasn't attached an article 
when they actually have.  Is there anything I can do to execute the scrip post 
process of attaching the article (I tried setting it to Transaction Batch).

Any ideas would be greatly appreciated.

Thanks

Nicola

[custom condition below]

my $RefersToTickets = $self->TicketObj->RefersTo;
my $FirstRefersToTicketLink = $RefersToTickets->Next;

my $returncode = 0;

my $txn = $self->TransactionObj;#
my $type = $txn->Type;
return 0 unless $type eq "Status"
    || ( $type eq 'Set' && $txn->Field eq 'Status');

if ($txn->NewValue eq "resolved") {

   eval {$FirstRefersToTicketLink->TargetURI->URI};
   my $results = $@;
   $RT::Logger->info('219 - ' . $results);
   if ($results =~ qr{^Can't call method}) {
      $RT::Logger->info('UNDEFINED');
      $returncode = 1;
   } else {
      $returncode = 0;
   };

};
  
$RT::Logger->info('Return Code: ' . $returncode); 
return $returncode;
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training

Reply via email to