[rt-users] Accessing Transactional Custom Fields From a Scrip

Anders Ekstrand anders.ekstrand at drutt.com
Wed Aug 10 02:32:28 EDT 2005


Hi Chris,

According to documentation on the Wiki, there is a
'$self->TransactionObj', that should be used instead of
'$self->TicketObj' to access the transactional custom fields.

I have never got this to work, unfortunately...

I ended up with the following scrip, that does not pick up any values:

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

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

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


Best Regards - Anders Ekstrand

> -----Original Message-----
> From: rt-users-bounces at lists.bestpractical.com 
> [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf 
> Of Christopher Snell
> Sent: den 10 augusti 2005 07:05
> To: rt-users at lists.bestpractical.com
> Subject: [rt-users] Accessing Transactional Custom Fields From a Scrip
> 
> Hi List,
> 
> Does anybody know how to access the value of a transactional custom
> field from a script?  I have some per-transaction custom fields and I
> want to be able to access its contents, if the user chooses to fill it
> in when updating a ticket.  However, when I try to access the field's
> value, I end up with the value for the per-ticket custom field
> instead.  Here's my code:
> 
> Condition:   On Transaction
> Action:   User Defined
> Template:  Global template: Blank
> Stage: TransactionCreate
> 
> Custom action preparation code:
> 
> return 1;
> 
> 
> Custom action cleanup code:
> 
> my $CFName = 'Billable (min)';
> my $cfvalue = $self->TicketObj->FirstCustomFieldValue( $CFName );
> open(DEBUGFILE,">>/tmp/debugcf");
> print DEBUGFILE "$CFName :: $cfvalue \n";
> close(DEBUGFILE);
> 
> What am I doing wrong here?  Can anybody offer any tips?  Tried the
> wiki to no avail.  :(
> 
> Chris
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Be sure to check out the RT Wiki at http://wiki.bestpractical.com
> 



More information about the rt-users mailing list