[rt-users] RT 3.8.10 is setting a CF value on new ticket creation?

Jeff Blaine jblaine at kickflop.net
Wed Aug 10 09:04:59 EDT 2011

On 8/9/2011 5:28 PM, Kevin Falcone wrote:
> On Tue, Aug 09, 2011 at 02:59:44PM -0400, Jeff Blaine wrote:
>> I'm confused and can't see that I am doing anything
>> wrong.  Either I *am* doing something wrong, or there's
>> a really bizarre bug in 3.8.10.  Surely it's the former.
> Since you don't say what the condition of the Scrip is, it's hard to
> know what the TransactionObj actually is, and whether or not it's
> relevant.
> But without knowing more about the contents of Transactions and
> ObjectCustomFieldValues I'd be guessing at problems.

Not that I think it matters (because disabling this scrip
still shows Discovery Method being set somewhere at ticket
creation)... but FWIW


Condition: On Create
Action: User Defined
Template: Global template: Blank
Stage: TransactionCreate

my $requestor_address = lc($self->TicketObj->RequestorAddresses);
my $subject = lc($self->TicketObj->Subject);

my %subj2discmethod = (
     'foo rule'       => 'Foo Sensor',
     'active proxy'   => 'Proxy',

my $discmethodset = 0;

foreach my $key (keys %subj2discmethod) {
     if ($subject =~ $key) {
         $RT::Logger->info("Subject '$subject' setting 'Discovery 
Method' to '$subj2discmethod{$key}'");
         my $cf = RT::CustomField->new($RT::SystemUser);
         $cf->LoadByName(Name => 'Discovery Method');
         $self->TicketObj->AddCustomFieldValue(Field => $cf,
                                       Value => $subj2discmethod{$key},
                                       RecordTransaction => 0);
         return 1;

$RT::Logger->info("No Discovery Method set by scrip 13.  No matches. 
Subject was '$subject' and requestor was '$requestor_address'");

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $testcf = new RT::CustomField($RT::SystemUser);

$testcf->LoadByName(Queue => $ticket->QueueObj->id, Name => "Discovery 
my $oldv = trim($self->TransactionObj->OldValue());
my $newv = trim($self->TransactionObj->NewValue());
$RT::Logger->info("Old value '$oldv' for Discovery Method.  New value 

return 1;

More information about the rt-users mailing list