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

scott.dalzell scott.dalzell at aveva.com
Thu Jul 18 07:15:10 EDT 2013


Hey guys

What i am trying to do is link 1 ticket CF (Bug_No) to another Ticket CF
(Ticket_No) by writing a script that will update the CF (Ticket_No) via the
mysql database when the CF (Bug_No) is updated

The reason i need it done in this manor is becasue this is a trial before
doing the same thing but between our RT and bugzilla systems where i will
have to update the CF(Ticket_No) in bugzilla via its mysql database on a
different server.

i already know how to do the custom donditions and manual update the mysql
databases for the action but how do i turn something like the following into
a script for mysql

where
objectid=16552 - test ticket used in example
customfield=12 - CF(Bug_No)
customfield=13 - CF(Ticket_No)

-------------------------------------------------------------------
manual mysql commands
-------------------------------------------------------------------
CREATE TEMPORARY TABLE temp_tbl SELECT * FROM objectcustomfieldvalues WHERE
objectid=16552 and customfield = '12';
UPDATE objectcustomfieldvalues set disabled=1 where objectid=16552 and
customfield=13;
UPDATE temp_tbl SET Customfield = 13;
select * from temp_tbl;
insert into objectcustomfieldvalues
(CustomField,ObjectType,ObjectId,SortOrder,Content,LargeContent,ContentType,ContentEncoding,Creator,Created,LastUpdatedBy,LastUpdated,Disabled)
Select
CustomField,ObjectType,ObjectId,SortOrder,Content,LargeContent,ContentType,ContentEncoding,Creator,Created,LastUpdatedBy,LastUpdated,Disabled
from temp_tbl;
DROP tABLE temp_tbl;
-------------------------------------------------------------------

thank you in advanced

Scott



--
View this message in context: http://requesttracker.8502.n7.nabble.com/How-to-update-CF-via-scripted-mySQL-commands-tp54656.html
Sent from the Request Tracker - User mailing list archive at Nabble.com.



More information about the rt-users mailing list