[Rt-devel] Bug in On-Transaction Scrip-ing?

Christopher Snell chris.snell at gmail.com
Wed Aug 10 20:11:07 EDT 2005


Hi,

I'm trying to get at a transactional custom field value from a scrip
but it's not working.  I wrote a CLI-based script which has no problem
extracting the custom field value from the transaction but the
Scrip-based approach cannot access the value.   Here is a the scrip
which fails:

--------------------------------------------------------------------------------------------------------
Conditon:  On Transaction
Action:  User Defined
Template:  Global template: Blank
Stage:  TransactionCreate

Custom action prep. code:

    return 1;

Custom action cleanup code:

    my $Transaction = $self->TransactionObj;
    my $CustomFieldValues=$Transaction->CustomFieldValues("Billable");
    $RT::Logger->error( "Parsing transaction custom fields:" );

    while (my $CustomFieldValue = $CustomFieldValues->Next) {
        $RT::Logger->error( "Value: ".$CustomFieldValue->Content );
    };

    $RT::Logger->error( "Done!" );
    return (1);
--------------------------------------------------------------------------------------------------------

And here is the CLI-based tool which *is* able to read the
transactional custom field values:

--------------------------------------------------------------------------------------------------------
#!/usr/bin/perl -I/home/rt/lib

use RT;
use RT::Transaction;

RT::LoadConfig();
RT::Init();

my $transaction = new RT::Transaction($RT::SystemUser);
$transaction->Load(9072);

my $CustomFieldValues=$transaction->CustomFieldValues("Billable");
print "Parsing custom fields ...\n";
while (my $CustomFieldValue = $CustomFieldValues->Next) {
       print "Value: " . $CustomFieldValue->Content . "\n";
};

print "Done.\n";
--------------------------------------------------------------------------------------------------------

Can anybody offer any suggestions on why the Scrip fails but the CLI
script succeeds?

Thanks in advance,

Chris Snell


More information about the Rt-devel mailing list