[rt-users] How to update CF via scripted mySQL commands

Craig Ringer craig at 2ndquadrant.com
Wed Jul 24 20:52:02 EDT 2013


On 07/22/2013 09:40 PM, scott.dalzell wrote:
> Thanks for pointing that out. i think ill try to do the API route as i cant
> afford to corrupt the database.
> 
> Can the RT API be used to modify a database that is not being used by RT.

When you load the RT perl modules they'll read RT_SiteConfig.pm for
database details and use that database.

It isn't really clear what you want here, though. Do you want to update
more than one database at a time? If so, nothing stops you from loading
DBI and opening direct DBI connections to other databases from within a
Perl script that also uses the RT APIs.

> Just that my final goal is to modify a field in our Bugzilla database (also
> MYsql) when an RT CF is given a bug number

You should do that by adding a scrip in RT.

Write a condition that checks whether the CF has been changed. I've
attached a condition I'm using that you can adapt if you want.

Then write an action that opens a Perl DBI connection to your Bugzilla
and issues the appropriate UPDATEs against Bugzilla. Or, better, use any
HTTP web service API bugzilla provides to do the update via Bugzilla
from within the RT scrip as a simple web service call - usually done
with LWP::Simple.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CustomFieldSetTo.pm
Type: application/x-perl
Size: 2839 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130725/750ba30a/attachment.bin>


More information about the rt-users mailing list