[rt-devel] script to test for keyword ?

Alan Horn ahorn at deorth.org
Mon Dec 8 18:30:42 EST 2003



Hey there,

I'm putting together a custom scrip in rt2 to test for the existence of a
specific keyword value. This keyword is used to determine what kind of
notification is sent out when a ticket is opened. We have two release of
software within the same queue and they need different sorts of responses.
So for one, people get paged (Ccs) and for the other, people only get
emailed (AdminCcs).

Inserted into the database :

mysql> insert into ScripConditions set Name = "OnPhase1.5Create",
Description = 'Phase 1.5 keyword ticket created',
ExecModule='phase15create', ApplicableTransTypes = 'Create';

And the script is :

package RT::Condition::phase10create;
require RT::Condition::Generic;

@ISA = qw(RT::Condition::Generic);


=head2 IsApplicable

If the ticket contains the Phase/1.5 keyword return true

=cut

sub IsApplicable {
    my $self = shift;
    if ($self->TicketObj->KeywordSelect-2 eq '1.5') {
        return(1);
    }
    else {
        return(undef);
    }
}


---

KeywordSelect-2 is the index for that tree of keywords (Phase/1.0 and
Phase/1.5) in RT.

Does this look right, or am I smoking crack here ? So sorry if this is a
trivial question, try as I might I haven't quite got there yet :)

All help appreciated.

Cheers,

Al




More information about the Rt-devel mailing list