RT::Links strange behaviour

I am using RT::Links to iterate over a tickets links in two places… one
in Ticket_Local.pm and one in a dhandler. It works fine within
Ticket_Local.pm but not from within the dhandler.

In Ticket_Local.pm, I’m using:

sub FindLinks {
my $self = shift;
my $links = new RT::Links($self->CurrentUser);
$links = $self->Links(‘Base’);
my $link=$links->Next();

if (defined $link) {

$RT::Logger->info(“found a link from Ticket_Local”);
}
return 1;
};

In a dhandler I’m using:

my $ticket = RT::Ticket->new($session{'CurrentUser'} );
$ticket->Load( $myticketid );
unless ( $ticket->id ) {
    $RT::Logger->error("Couldn't load ticket #$myticketid");
    return $m->abort( 404 );
}
$ticket->FindLinks();
my $links = new RT::Links($session{'CurrentUser'} );
$links = $ticket->Links('Base');
my $link = $links->Next();

if (defined $link) {
$RT::Logger->info("found a link from dhandler");
}

I only get “found a link from Ticket_Local” in logs.

Anyone know why?

NOTE: I know the example doesn’t make sense - but its concise. :slight_smile:

Thanks,

-Bob