Finding a merged ticket via API

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have a perl script that uses the RT API to find tickets meeting certain
criteria. For example, all tickets with a specified string in the
subject, or a ticket with a specific ID. It works fine, except tickets
that have been merged into other tickets are not found under their
original IDs. Yet, in the Web interface, if I enter a ticket ID that has
been merged into another, it will show me the other ticket, which is what
I want.

What do I have to do in my API script to accomplish what the Web interface
does? For example, if ticket 12345 has been merged into ticket 23456, I’d
like to be able to tell my script I want to see ticket 12345 and have it
show me ticket 23456.

My script has this code:

my $TicketList = RT::Tickets->new($RT::SystemUser);
my $TicketObj = RT::Ticket->new($RT::SystemUser);
...
$TicketList->LimitId(OPERATOR => '=', VALUE => $opt_i);
...
$TicketNextObj = $TicketList->First;
unless ($TicketNextObj) {
   <print 'Not found'>
   exit;
   }
while ($TicketNextObj) {
   $TicketObj->Load($TicketNextObj->Id);
   ...
   ...
   $TicketNextObj = $TicketList->Next;
   }

(where ‘$opt_i’ is the ticket ID supplied as an option argument to the
script).

Similarly, if a string is supplied as argument to the script, I use this
search:

$TicketList->LimitSubject(OPERATOR => 'LIKE', VALUE => $string);

In both of the above cases, ticket IDs that have been merged are not
found. Is there something I must add to my code to get the same result as
I would through the Web interface?

I could live with the second search returning only the merged ticket ID in
the list of tickets meeting the Subject criteria, as it does now. But, in
the first case, when I ask for a specific ticket ID, I’d like to get the
information for the merged ticket instead of just ‘Not found’.

Thanks.

Mike

Mike Friedman System and Network Security
mikef@ack.Berkeley.EDU 2484 Shattuck Avenue
1-510-642-1410 University of California at Berkeley
http://ack.Berkeley.EDU/~mikef http://security.berkeley.edu

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQA/AwUBRGyf0q0bf1iNr4mCEQLSYACfUrUkvdRBIpqYWpTa4sClDO8kxg4AoKVK
FhS2a5ieiaapu1M+ZIJdhK9J
=PrFN
-----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On Thu, 18 May 2006 at 09:24 (-0700), I wrote:

I have a perl script that uses the RT API to find tickets meeting
certain criteria. For example, all tickets with a specified string in
the subject, or a ticket with a specific ID. It works fine, except
tickets that have been merged into other tickets are not found under
their original IDs. Yet, in the Web interface, if I enter a ticket ID
that has been merged into another, it will show me the other ticket,
which is what I want.

What do I have to do in my API script to accomplish what the Web
interface does? For example, if ticket 12345 has been merged into
ticket 23456, I’d like to be able to tell my script I want to see ticket
12345 and have it show me ticket 23456.

Never mind. I’ve accomplished what I want just by using the
$TicketObj->Load method, instead of $TicketList->LimitID. Apparently the
latter doesn’t know how to resolve links.

Mike

Mike Friedman System and Network Security
mikef@ack.Berkeley.EDU 2484 Shattuck Avenue
1-510-642-1410 University of California at Berkeley
http://ack.Berkeley.EDU/~mikef http://security.berkeley.edu

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQA/AwUBRGy72K0bf1iNr4mCEQLQdwCaA802ACf7nmFrBQmfaBfr/GQh1sIAniV+
gRxF6bAo35nsQoFb+JHFC3Gc
=gycX
-----END PGP SIGNATURE-----