[rt-users] Trouble with notification scrip

Kenneth Crocker KFCrocker at lbl.gov
Thu May 17 19:30:41 EDT 2007


To all,

	I am new to RT and Perl. I have been trying to learn how to change some 
of this stuff by looking at the code you all write about as well as look 
at the RT Essentials book. I have a new scrip that has the following 
parameters set:

Condition: User Defined
Action: NotifyOwner
Template: Global template: Reviewed (a new I created)
Stage: TransactionCreate

I have tried several version of this code:
my $trans = $self->TransactionObj;

return 1 if {$trans->Type eq "CustomField" &&
              $trans->Field == get_custom_id('Approval-Status') &&
              $trans->NewValue eq "Reviewing Request"};

and this version:
my $trans = $self->TransactionObj;

return 1 if {$trans->Type eq "CustomField" &&
              $trans->Field eq "Approval-Status" &&
              $trans->NewValue eq "Reviewing Request"};

and this version:
my $trans = $self->TransactionObj;

return o unless {$trans->Type eq "CustomField" &&
                  $trans->Field eq "Approval-Status" &&
                  $trans->NewValue eq "Reviewing Request"};


and this version:
my $trans = $self->TransactionObj;

return o unless {$trans->Type eq "CustomField" &&
                  $trans->Field == get_custom_id('Approval-Status') &&
                  $trans->NewValue eq "Reviewing Request"};

and this version:
my $trans = $self->TransactionObj;

return o unless {$trans->Type eq "CustomField"};
return 1 if {$trans->Field eq "Approval-Status" &&
              $trans->NewValue eq "Reviewing Request"};

All but the latter sent out a notification regardless of what field I 
changed or what I changed it to. The last one never worked at all, period.

I am getting EXTREMELY frustrated with this. I can't find a good example 
of what I'm trying to do in the RT Essentials book, which makes it 
practically useless for and many others, I would think. I've tried 
various code from several of you users and that doesn't work.

I feel like either I'm an idiot or RT  needs to be better documented for 
stuff like this for dummies like me. Not everyone who gets/inherits this 
system knows Perl well (and all the gadzillion variations of the same 
working code, which is confusing) let alone how to apply it to RT. I 
looked at the OVERLAY stuff and that doesn't seem very well spelled out 
as well.

I need help or I'm just gonna have to throw up my hands and forget it.
Thanks.

Kenn
LBNL



More information about the rt-users mailing list