[Rt-devel] Question about user defined condition

lwang lwang at clusterfs.com
Thu Nov 17 05:10:57 EST 2005

Hi there,

I have put the following piece of code in 

package RT::Condition::OnDelete;
require RT::Condition::Generic;

use strict;
use vars qw/@ISA/;
@ISA = qw(RT::Condition::Generic);

sub IsApplicable {
         my $self = shift;
         return ($self->TicketObj->status eq 'deleted');


And then enabled it by the following code:

use strict;
use lib "/opt/rt3/lib/";

use RT;
use RT::Interface::CLI qw( CleanEnv GetCurrentUser );
use RT::ScripCondition;


my $user = GetCurrentUser();
unless( $user->Id ) {
         print "No RT user found. Please consult your RT administrator.\n";
         exit 1;

my $sc = RT::ScripCondition->new($user);

$sc->Create( Name       => "On Delete",
              Description=> "When a ticket is deleted",
              ExecModule => "OnDelete",
              ApplicableTransTypes=> 'Status',

And then I set a scrip to notify the owner on deletion.  However the 
owner never get a notification.  BTW, my email server works well.

Any suggestion is appreciated.


More information about the Rt-devel mailing list