[rt-users] Adding custom field values from Perl script.

Stephen Turner sturner at MIT.EDU
Mon Dec 11 10:03:40 EST 2006


> -----Original Message-----
> From: rt-users-bounces at lists.bestpractical.com 
> [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf 
> Of Jacob Helwig
> Sent: Saturday, December 09, 2006 9:38 AM
> To: rt-users at lists.bestpractical.com
> Subject: RE: [rt-users] Adding custom field values from Perl script.
> 
> Certainly:
> 
>		if ($ticket->AddCustomFieldValue({ Field => 7, Value =>
>"" . $surveyid[0] . "" })) {
>			print "\tOK!\n";
>		} else {
>			print "\tFAILED!\n";
>			$dbh->pg_rollback_to("requestor_entry");
>		}
>

Jacob, 

I can't see anything obviously wrong with the AddCustomFieldValue statement
- I'd recommend using the Perl debugger to step into the AddCustomFieldValue
method (in Record.pm) and see what it does.

I'm wondering about the use of the transaction control on the $dbh handle
though. The only database updates in the script are done through the RT API
using a separate database handle ($RT::Handle) - so the rollbacks, commits,
etc that you do on $dbh have no effect on these updates. The RT API has
methods to control transactions, so it might be better to use those.

Steve




More information about the rt-users mailing list