Showing custom field in autocomplete parents popup

Hi There,

Wondering if anyone can suggest how I might attempt to modify the auto-complete drop down box for linking of tickets to include a custom field in the text?

e.g. I create a monthly support ticket for each customer with the same ticket title, so when I attempt to find it in autocomplete, it shows them all without being able to distinguish which customer it’s for. I have a custom field named ‘Company’ that I’d like to include in the text of the autocomplete.



if you’re willing to do some coding, you can overlay share/html/Helpers/Autocomplete/Tickets to return the custom field value instead of subject

Thank you for the pointer - I’m comfortable with Perl so I’ll have a look at some other code & see if I can adapt something.

With your pointer, I found the existing code and found reference to $TicketAutocompleteFields, and worked out I could at least filter on company:

Set( $TicketAutocompleteFields, {
    id      => 'STARTSWITH',
    Subject => 'LIKE',
    'CF.{Company}' => 'LIKE',

I’ll see how I go with customising the return string.


That proved to be easier than expected! Thanks for your assistance :slight_smile:

--- /opt/rt5/share/html/Helpers/Autocomplete/Tickets	2020-08-28 21:50:52.950814645 +0930
+++ /opt/rt5/local/html/Helpers/Autocomplete/Tickets	2020-10-15 22:41:12.738854665 +1030
@@ -107,7 +107,9 @@
 my @suggestions;
 while ( my $ticket = $tickets->Next ) {
-    my $formatted = loc("#[_1]: [_2]", $ticket->Id, $ticket->Subject);
+    my $company = $ticket->FirstCustomFieldValue( 'Company' ) || '';
+    my $formatted = loc("#[_1]: [_2] ([_3])", $ticket->Id, $ticket->Subject, $company);
     push @suggestions, { label => $formatted, value => $ticket->$return };

Awesome, best practice is to make the change on a local overlay of that file too so that if you ever update you don’t lose them. You can do that by placing the file at “/opt/rt5/local/html/Helpers/Autocomplete/Tickets”

1 Like