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->QueueObj->id,
Name => "Approval-Status");
return 0 unless $cf->id;
if ($trans->Field == $cf->id &&
$trans->NewValue eq "Reviewing Request")
{
return 1;
}
}
return 0;
and it worked real well. I guess I just didn't realise the QueueObj
requirement for identifying a field in the transaction record for this.
I won't forget now. I STILL believe that someone should put out an
"Essentials" book for morons with all kinds of simple examples to model
after. Thanks again. Now all I have to do is add some more code to
modify another custom field and the ticket status while it sends out the
notification.
Kenn
LBNL
Stephen Turner wrote:
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 alter a field or custom field, field tracks what was
changed". That sounds to me like all I should need to refer to is the
name of the field, not what Queue it is in. I can't find an easy
reference to this kind of relationship. I find that the RT Essentials
book could do a MUCH better job of making some of this stuff easier to
understand, like more specific examples and models of various code
(like how to trigger a notification from a CF being changed or how to
do that plus modify another field (custom or otherwise)). It would
seem to me that for beginners like myself, simple little things like
that would make a world of difference in our ability to get some
simple modifications going.
Jesse, how about it? Is a new and updated release due out soon?
Kenn
LBNL
Hello Kenn,
RT allows you to have many custom fields with the same name - you could
have more than one queue with an "Approval-Status" custom field, for
example. So you need to specify the queue when getting a custom field so
that you get the right one. However, I just noticed that RT allows you
to have multiple fields with the same name in the same queue, so the
uniqueness of field name & queue is not enforced. In reality though, you
wouldn't choose to have the same name for multiple fields in a queue, so
the assumption that queue and field name uniquely identifies a
queue-custom field is probably a safe one.
Steve
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com