[rt-users] Finding a merged ticket via API

Mike Friedman mikef at ack.Berkeley.EDU
Thu May 18 12:24:46 EDT 2006


-----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 at 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-----



More information about the rt-users mailing list