[rt-users] Creating my own Scrip conditions

Kenneth Crocker KFCrocker at lbl.gov
Mon Oct 20 17:38:44 EDT 2008


Richard,


	I use something like this to test a CF Value:

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;

if  ($trans->Type eq 'CustomField')
     {my $cf = new RT::CustomField($RT::SystemUser);
         $cf->LoadByName(Queue => $ticket->QueueObj->id,
          Name => "QA Approved");
      return 0 unless $cf->id;
      if  ($trans->Field == $cf->id &&
           $trans->NewValue eq "Yes")
           {
            return 1;
           }
     }

return 0;

	I even have some compound conditions in code. I find this MUCh easier 
to maintain than fooling around in the directories. Just a thought.

Kenn
LBNL

On 10/20/2008 1:44 PM, Richard Hartmann wrote:
> On Mon, Oct 20, 2008 at 21:50, Kenneth Crocker <KFCrocker at lbl.gov> wrote:
> 
>>        I'm not sure I understand WHY you are creating new conditions.
> 
> Because I need to test on the status of CF.{zabbix_event_status}
> 
> 
>> If you
>> are trying to create your own scrips for non-default situations, I would
>> recommend setting the Condition to "User-defined" and coding the correct
>> perl for that condition. I do not understand why you would want top mess
>> around with the code in the directories. Is there some condition you need to
>> look for that is not codable in perl?
> 
> No, but jibsheet in #rt suggested this approach as you can then check in
> your changes into svn. Also, I could not find any useful snippets for the
> scrip conditions (i.e. what is needed, what to leave out when compared to
> the file-based approach) whereas it's trivial to template from the files.
> 
> 
> Thanks,
> Richard
> 




More information about the rt-users mailing list