Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Kenneth Crocker
Stephen, Thanks a bunch. I used your code (with a little modification) as follows: my $trans = $self->TransactionObj; my $ticket = $self->TicketObj; if ($trans->Type eq 'CustomField') {my $cf = new RT::CustomField($RT::SystemUser); $cf->LoadByName(Queue => $ticket->QueueOb

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Kenneth Crocker
Gene, Upon further thought, maybe the fact that the CF is defined as "select ONE value" it tries to delete the old value associated with the ticket since it is being replaced with another value. Or maybe it updates the ticket custom field first with the new value and then tries to delete the

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Kenneth Crocker
Gene, I created the CF as "select one value" and a list of about 6 different values, all of which show when update the cf. It is applied to "Tickets" and I have it applied to the Queue I am using for the test. That's why the error doesn't make sense to me. Every time I change it to some diff

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Stephen Turner
At Friday 5/18/2007 01:33 PM, Kenneth Crocker wrote: Stephan, I have another question; why all the references to QueueObj? On page 129 of the RT Essentials book (in reference to Transactions, I am assuming transactions generated by changing a field, etc.) it says "For updates that al

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Gene LeDuc
Kenn, something is odd here. I just grepped the RT code for that error message and it only seems to appear as an error message that is generated if an attempt is made to delete a custom value that is not in the specified custom field (like trying to delete "xyz" from CF1 if it's not in CF1).

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Kenneth Crocker
Stephan, I have another question; why all the references to QueueObj? On page 129 of the RT Essentials book (in reference to Transactions, I am assuming transactions generated by changing a field, etc.) it says "For updates that alter a field or custom field, field tracks what was changed".

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Stephen Turner
At Friday 5/18/2007 01:19 PM, Kenneth Crocker wrote: Stephan, A question; why do you have ($trans->NewValue && $trans->NewValue eq "Reviewing Request") in the code? it looks like $trans->NewValue is in there twice. I don't understand why it is not just if ($

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Kenneth Crocker
Stephan, A question; why do you have ($trans->NewValue && $trans->NewValue eq "Reviewing Request") in the code? it looks like $trans->NewValue is in there twice. I don't understand why it is not just if ($trans->Field == $cf->id && $trans->NewValue eq "R

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Stephen Turner
Kenn, The following code might do what you need - it's taken from a similar scrip we use. Steve my $trans = $self->TransactionObj; if ($trans->Type eq 'CustomField') { my $cf = new RT::CustomField($RT::SystemUser); $cf->LoadByName(Queue => $self->TicketObj->QueueObj->id,

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Gene LeDuc
I used "==" in the second comparison instead of "eq" because that's what you had. It should work because the CF id is an integer and get_custom_id() returns an integer or undef, so you're comparing integers. Sometimes perl is pretty good about making things work when they aren't quite correct

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Kenneth Crocker
Gene, I just tried the code: my $trans = $self->TransactionObj; return ($trans->Type eq "CustomField" && $trans->Field == get_custom_id("Approval-Status") && $trans->NewValue eq "Reviewing Request"); and I got the error "* Custom field value Reviewing Request could not

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Stephen Turner
At Friday 5/18/2007 12:09 PM, Kenneth Crocker wrote: Gene, Sorry for all the hassle. In the Perl class I took, I got the impression that it didn't matter what type of brackets you used, as long as they matched left & right. Also, why do you use == in the second line? Why not just ano

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Stephen Turner
At Friday 5/18/2007 12:09 PM, Kenneth Crocker wrote: Gene, Sorry for all the hassle. In the Perl class I took, I got the impression that it didn't matter what type of brackets you used, as long as they matched left & right. Also, why do you use == in the second line? Why not just ano

Re: [rt-users] Trouble with notification scrip

2007-05-18 Thread Kenneth Crocker
Gene, Sorry for all the hassle. In the Perl class I took, I got the impression that it didn't matter what type of brackets you used, as long as they matched left & right. Also, why do you use == in the second line? Why not just another eq? Another question; I was under the impression that i

Re: [rt-users] Trouble with notification scrip

2007-05-17 Thread Gene LeDuc
Kenn, you're using curly brackets to enclose the condition phrase. In this case you really don't need to enclose it at all, but if you do then you need to use parentheses. This should work: return 1 if $trans->Type eq "CustomField" && $trans->Field == get_custom_id("Approval-Status") && $tr

[rt-users] Trouble with notification scrip

2007-05-17 Thread Kenneth Crocker
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: