-my $Query = $search_relation . ' = ' . $id;
-my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query);
+if ($Object and $Object->id) {
+ my $id = $Object->id;
+
+ if ($Object->isa("RT::Ticket")) {
+ $SearchURL = RT->Config->Get('WebPath')
+ . '/Search/Results.html?'
+ . $m->comp('/Elements/QueryString', Query => "$search_relation = $id");
+ }
+}
+
+$m->callback(
+ CallbackName => "ModifySearchURL",
+ SearchURL => \$SearchURL,
+ ARGSRef => \%ARGS,
+);