[rt-users] Pointers for the unfamiliar - creating custom behaviours

Kevin Falcone falcone at bestpractical.com
Wed Feb 5 10:55:52 EST 2014


On Wed, Feb 05, 2014 at 03:42:38PM +0000, Simon Wilcox wrote:
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 235 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140205/e2a06562/attachment.sig>


More information about the rt-users mailing list