[rt-users] On Custom Field change scrip action
Gene LeDuc
gleduc at mail.sdsu.edu
Fri Apr 18 12:04:54 EDT 2008
Hi Ben,
I use this as a User Defined Custom Condition to detect a change in a CF
named "DMCA State":
{ ### True on state change to ITSO_Review
my $Transaction = $self->TransactionObj;
return $Transaction->Type eq 'CustomField'
&& $Transaction->Field eq '3'
&& get_custom('DMCA State') eq 'ITSO_Review'
;
sub get_custom {
### Returns custom field value
### get_custom($field_name)
my $target_name = $_[0];
my $val = $self->TicketObj->FirstCustomFieldValue($target_name);
return $val
if defined $val;
return undef;
}
}
I wrote this quite a while ago; from what I've learned of RT since then, I
suspect I could have used the CF's name "DMCA State" instead of it's ID "3"
like this:
&& $Transaction->Field eq "DMCA State"
Of course, what you are detecting is going to be different, but you should
be able to use this as a guide.
Disclaimer: I know this code could be reduced to 1 or 2 lines, but my
coding philosophy is that readability trumps terseness.
Regards,
Gene
At 01:08 AM 4/18/2008, Ben Robson wrote:
>Greetings,
>
>I am not sure where to start with this one.... I'd like to have a check
>box custom field on tickets so that when the box is ticked an email is
>sent to a fixed email address notifying them that the box has been ticked.
>
>Effectively: OnUpdate -> Check if CustomField checkbox has been
>selected(ticked) -> If yes, send defined_template to fixed_email_address.
>
>I have seen a few people doing something similar using the OnResolve
>condition, but we need to be able to flag a job before resolution, so need
>to use a custom field to set when the fixed_email recipient should be notified.
>
>Does anyone have any good insight as to how to make this happen?
>
>Thanks heaps for your assistance with this.
>
>Best regards,
>BenR
--
Gene LeDuc, GSEC
Security Analyst
San Diego State University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20080418/52e3912f/attachment.htm>
More information about the rt-users
mailing list