Closing Refered Tickets


I’m trying to work out a Scrip which would resolve tickets which are Refered To the ticket being closed. So far I’m not getting all that lucky trying to find them.

my $flood_search = RT::Tickets->new($RT::SystemUser);
$flood_search->LimitQueue(VALUE => 'QUEUENAME');
$flood_search->LimitLinkedTo(TYPE => 'ReferredToBy', VALUE => $self->TicketObj->Id);

The above renders a lot more tickets than expected as compared to a normal search "Queue = ‘QUEUENAME’ AND ReferredToBy = "

I came to realize I can use FromSQL search instead…

my $flood_search = RT::Tickets->new($RT::SystemUser);
$flood_search->FromSQL("Queue = 'QUEUENAME' AND ReferredToBy = " . $self->TicketObj->Id);