Pointers for the unfamiliar - creating custom behaviours

Hi,

We’ve used RT for probably 10 years but really in a very vanilla way.
We’re now trying to make better use of it (4.0.8 now and imminently
4.2.2) but I’m struggling to find a way in to add a feature that we’d like.

What we’d like to do is auto-link tickets together whenever they’re
mentioned in a comment or response. The regex to extract the ticket
numbers from the body of the message I have and I think I know how to
create a link[1] but I can’t figure out the recommended way to
incorporate that code into a scrip.

I’m probably missing something in the docs but please could you advise
how to go about putting this together ?

Many thanks,

Simon.

[1] based on the code in RT/Ticket.pm it will be something like
$self->AddLink( Type => ‘RefersTo’, Target => $found_id );

What we’d like to do is auto-link tickets together whenever they’re
mentioned in a comment or response. The regex to extract the ticket
numbers from the body of the message I have and I think I know how
to create a link[1] but I can’t figure out the recommended way to
incorporate that code into a scrip.

I’m probably missing something in the docs but please could you
advise how to go about putting this together ?

[1] based on the code in RT/Ticket.pm it will be something like
$self->AddLink( Type => ‘RefersTo’, Target => $found_id );

In the custom action commit code you can get the current ticket with:
$self->TicketObj and then it’s just a matter of gluing on the
appropriate AddLink call as you’ve found above.

Keep in mind directionality of the link, which will determine if you
want Target or Base (RefersTo vs ReferredToBy).
In 4.2, relevant docs are on RT::Record::_AddLink and
http://bestpractical.com/docs/rt/latest/RT/Record/Role/Links.html#AddLink1

-kevin