Merge tickets, transaction notification and REST

We have a scrip that runs “On Transaction” and calls an external script,
passing the ticket id. We want to take actions in the external script when
a ticket is merged. If we merge, say, ticket 100 into ticket 200, the
ticket id passed to our external script is 200. How can we find out, via
the REST interface, the ticket id that was merged (100 in this example)?

Frustratingly, going the other way is easy - if we retrieve ticket
information for 100 via the REST interface, ticket 200 is retrieved.

If it helps, here’s our scrip (we are not Perl wizards, which may be
stating the obvious when you see the code below: all criticism gratefully
received):

my $tx = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $id = $ticket->id;
my $type = $tx->Type;
my $field = $tx->Field;
my $old = $tx->OldValue;
my $new = $tx->NewValue;

system(“wget
http://localhost/xyz/transaction?rt=$id".‘&type=’.“$type”.‘&field=’.“$field”.‘&old=’.“$old”.‘&new=’."$new’”)

Thanks

Is it not possible to detect which ticket is being merged?

Kieth,

The LINKS Table will have that info. Type is “MergedInto”.

Kenn
LBNLOn Tue, Apr 27, 2010 at 4:28 PM, Kenneth Crocker kfcrocker@lbl.gov wrote:

Kieth,

The LINKS Table will have that info. Type is “MergedInto”.

Kenn
LBNL

On Tue, Apr 27, 2010 at 2:53 PM, Keith Edmunds kae@midnighthax.comwrote:

Is it not possible to detect which ticket is being merged?

We have a scrip that runs “On Transaction” and calls an external script,
passing the ticket id. We want to take actions in the external script
when a ticket is merged. If we merge, say, ticket 100 into ticket 200,
the ticket id passed to our external script is 200. How can we find out,
via the REST interface, the ticket id that was merged (100 in this
example)?

Frustratingly, going the other way is easy - if we retrieve ticket
information for 100 via the REST interface, ticket 200 is retrieved.

If it helps, here’s our scrip (we are not Perl wizards, which may be
stating the obvious when you see the code below: all criticism
gratefully
received):

my $tx = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $id = $ticket->id;
my $type = $tx->Type;
my $field = $tx->Field;
my $old = $tx->OldValue;
my $new = $tx->NewValue;

system(“wget
http://localhost/xyz/transaction?rt=$id
".’&type='.”$type".‘&field=’.“$field”.‘&old=’.“$old”.‘&new=’.“$new’”)

Thanks

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

On Tue, 27 Apr 2010 16:29:01 -0700, kfcrocker@lbl.gov said:

The LINKS Table will have that info. Type is “MergedInto”.

Thanks for that. It doesn’t show on my version of RT, but perhaps I need
to upgrade (we’re using 3.6.7)

Keith

Hi Kenneth,

When you say the links table has that info - are you saying that a
direct DB call is necessary, or can the links table info be got at via
REST? When I tried I couldn’t determine the necessary REST syntax.
Sorry to thread hijack, but I’m trying to achieve something similar to
Keith!

Thanks,
Robin.

Kenneth Crocker wrote:

Robin,

No, you can’t get it with REST. That would be nice. They DO have LinkedTo,
but that is the opposite of what you want. They don’t have a LinkedFrom or a
“TicketID” (RT uses the EffectiveID when do ing searches for Tickets), which
would be a nice feature. You will have to write a separate SQL to do this.

Kenn
LBNLOn Wed, Apr 28, 2010 at 2:10 AM, Robin Williams r.williams@lancs.ac.ukwrote:

Hi Kenneth,

When you say the links table has that info - are you saying that a direct
DB call is necessary, or can the links table info be got at via REST? When
I tried I couldn’t determine the necessary REST syntax. Sorry to thread
hijack, but I’m trying to achieve something similar to Keith!

Thanks,
Robin.

Kenneth Crocker wrote:

Kieth,

The LINKS Table will have that info. Type is “MergedInto”.

Kenn
LBNL

On Tue, Apr 27, 2010 at 4:28 PM, Kenneth Crocker <kfcrocker@lbl.gov<mailto: kfcrocker@lbl.gov>> wrote:

Kieth,

The LINKS Table will have that info. Type is “MergedInto”.

Kenn
LBNL

On Tue, Apr 27, 2010 at 2:53 PM, Keith Edmunds <kae@midnighthax.com mailto:kae@midnighthax.com> wrote:

   Is it not possible to detect which ticket is being merged?

   > We have a scrip that runs "On Transaction" and calls an
   external script,
   > passing the ticket id. We want to take actions in the
   external script
   > when a ticket is merged. If we merge, say, ticket 100 into
   ticket 200,
   > the ticket id passed to our external script is 200. How can
   we find out,
   > via the REST interface, the ticket id that was merged (100
   in this
   > example)?
   >
   > Frustratingly, going the other way is easy - if we retrieve
   ticket
   > information for 100 via the REST interface, ticket 200 is
   retrieved.
   >
   > If it helps, here's our scrip (we are not Perl wizards,
   which may be
   > stating the obvious when you see the code below: all
   criticism gratefully
   > received):
   >
   > my $tx = $self->TransactionObj;
   > my $ticket = $self->TicketObj;
   > my $id = $ticket->id;
   > my $type = $tx->Type;
   > my $field = $tx->Field;
   > my $old = $tx->OldValue;
   > my $new = $tx->NewValue;
   >
   > system("wget
   >
   'http://localhost/xyz/transaction?rt=$id

“.‘&type=’.”$type".‘&field=’.“$field”.‘&old=’.“$old”.‘&new=’.“$new’”)
>
> Thanks

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com