1 package RT::Condition::CustomFieldChange;
2 use base 'RT::Condition';
7 If a custom field has a particular value.
11 # Based on Chuck Boeheim's code posted on the RT Wiki 3/13/06
15 my $trans = $self->TransactionObj;
16 my $scrip = $self->ScripObj;
17 my %Rules = $self->Rules;
18 my ($field, $value) = @Rules{'field', 'value'};
19 return if !defined($field) or !defined($value);
21 if ($trans->Type eq 'Create') {
22 return 1 if $trans->TicketObj->FirstCustomFieldValue($field) eq $value;
24 if ($trans->Type eq 'CustomField') {
25 my $cf = RT::CustomField->new($self->CurrentUser);
27 return 1 if $trans->Field == $cf->Id and $trans->NewValue eq $value;
34 my %args = ( 'QueueObj' => undef, @_ );
35 my $QueueObj = $args{'QueueObj'};
36 my $cfs = $QueueObj->TicketCustomFields();
38 while ( my $cf = $cfs->Next ) {
39 push @fieldnames, $cf->Name, $cf->Name;
44 'label' => 'Custom Field',
46 'options' => \@fieldnames,