[Rt-devel] getting ticket content from another perl script while ticket is being saved/updated

Joby Walker joby at u.washington.edu
Thu Oct 27 17:37:36 EDT 2005


You could try running the scrip in the TransactionBatch stage and if
that doesn't work you could have your script sleep for a few seconds
(2-5) before it trys to connect to the database.

Joby Walker
ITI SSG, University of Washington


Vipin Hegde wrote:
> With a lot of help from Joby, I've setup a scrip which calls a
> custom-built perl script whenever a Ticket gets created/updated. That
> call seems to work fine; the only problem is that when I create a ticket
> (using the web interface of RT), which in turn kicks off the call to the
> scrip; the perl script that's called by the script cannot find the
> ticket data in the mysql database; it's looks as if both the data
> updation as well as the call to the perl script are wrapped up in one
> single transaction, which is preventing the perl script's "select SQL "
> from seeing the data that's just been inserted into the database. If I
> run the same SELECT stmt a couple of seconds after the ticket's created
> (or if I run my perl script manually a second or so after the ticket's
> created), the SQL runs fine . 
> 
> Here's the SQL stmt:
> select
>   a.content,
>   t.type
> from 
>   Transactions t,
>   Attachments a
> where
>   t.id = a.TransactionId and
>   t.id = $tran_id
> 
> 
> where $tran_id is the Transaction ID which is being passed by the Scrip,
> which I've setup in RT. Here's the scrip code:
> 
> ========================================================================
> ====my $ticket = $self->TicketObj->Id;
> my $tran_id = $self->TransactionObj->Id;
> 
> `/www/cgi-bin/test.pl --ticket_id=$ticket --tran_id=$tran_id`;
> 
> ========================================================================
> ====
> 
> 
> So my question is, is there a way to get the ticket content from my
> custom script when it's called from the Scrip?
> 
> Regards,
> Vipin
> 
> 
> _______________________________________________
> Rt-devel mailing list
> Rt-devel at lists.bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel


More information about the Rt-devel mailing list