[Rt-devel] Creating Tickets Programmatically

Stephen Turner sturner at MIT.EDU
Mon Sep 24 10:14:33 EDT 2007

At Sunday 9/23/2007 05:21 PM, Douglas von Roeder wrote:
>Hello All
>I'm working on a project for a client who's using RT.
>I'm trying to create Tickets in RT programactically and stumped 
>about how to add a "Notes" field.
>I'm able to log in to the MySQL database, insert a Ticket row and 
>assign data to the columns. The problem that I'm facing is that I 
>have a few dozen lines of text that I want to "attach" to a note 
>that provides detailed information for the ticket.
>My client has told me to put it the Attachment table which looks 
>good since it's related to the Transaction via TransactionID. 
>However there's no TicketID in Transaction.
>Do I populate Transaction'ObjectId with the ID of the Ticker to 
>relate a Transaction back to a Ticket?
>Thanks in advance.
>Douglas von Roeder

Hello Douglas,

You're heading for trouble if you're trying to do this via SQL - 
there are all kinds of ticket-related rows in other tables that you'd 
need to know how to update correctly. You could spend a good part of 
the rest of your life figuring that out from scratch. You'd be better 
off using the RT Perl API, which does all this hard work for you. For 
example, look in RTHOME/lib/RT/Ticket_Overlay.pm (or do a perldoc on 
that file) to see how to create tickets using the API.

Good luck -

>List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel

Stephen Turner
Senior Programmer/Analyst - Client Support Services
MIT Information Services and Technology (IS&T)

More information about the Rt-devel mailing list