RT3 - Custom Field search box in at a glance

Hi All,

Within our relatively new instance of RT 3.8.10 an custom field is created for the external ticket / reference number. Despite searches, possibly with wrong words, on RT-Users and the Wiki the following question still remains:

The normal search box above doesn’t return any matches on the “Ext Ticket #” custom field despite being a global custom field. When performing an query via the query builder searches for a ext ticket number, for instance 11111 works fine and the internal ticket 1030 is returned. When there we have an internal ticket which has the same ID as stored in an other ticket for the ext ticket # then the internal ticket is shown directly.

What we would like to do is present an special search box on the “RT at a glance” page where the search is solely performed on the custom field. Is there any way to do this with the base functions of RT or via an extension?

If this is not available, are there some pointers available how one can create, via a bit a perl or so, an item on the “RT at a glance” page with this search form that will populate a field in a saved search or otherwise?

Thanks in advance,
Stijn

Yours Sincerly / Met Vriendelijke groet,
Stijn Jonker

Hi,

Take a look into index.html where that input box is processed
initially. There is a callback to analyze string and implement custom
action.

Want to note that RT4 has better abstraction of simple search and it’s
easier to implement a new syntax there.On Wed, Jul 27, 2011 at 8:41 AM, Stijn Jonker sjcjonker@sjc.nl wrote:

Hi All,

Within our relatively new instance of RT 3.8.10 an custom field is created for the external ticket / reference number. Despite searches, possibly with wrong words, on RT-Users and the Wiki the following question still remains:

The normal search box above doesn’t return any matches on the “Ext Ticket #” custom field despite being a global custom field. When performing an query via the query builder searches for a ext ticket number, for instance 11111 works fine and the internal ticket 1030 is returned. When there we have an internal ticket which has the same ID as stored in an other ticket for the ext ticket # then the internal ticket is shown directly.

What we would like to do is present an special search box on the “RT at a glance” page where the search is solely performed on the custom field. Is there any way to do this with the base functions of RT or via an extension?

If this is not available, are there some pointers available how one can create, via a bit a perl or so, an item on the “RT at a glance” page with this search form that will populate a field in a saved search or otherwise?

Thanks in advance,
Stijn


Yours Sincerly / Met Vriendelijke groet,
Stijn Jonker


2011 Training: http://bestpractical.com/services/training.html

Best regards, Ruslan.

Ruslan & Others,

Take a look into index.html where that input box is processed
initially. There is a callback to analyze string and implement custom
action.

I did but, whatever I tried no success; I don’t want to scream bug, but maybe call this an undocumented feature… The issue is that I already modified the Googlish.pm module to add to the section:

for my $key (@keywords) {

    # Is this a ticket number? If so, go to it.
    # But look into subject as well
    if ( $key =~ m/^\d+$/ ) {
        push @id_clauses, "id = '$key'", "Subject LIKE '$key'", "CF.{ExtTicketId} LIKE '$key'";
    }

the “CF.{ExtTicketId} LIKE ‘$key’” item, but whatever I did when entering a numeric item it never found anything. Then I found in “Simple.html” the section:

if ($q =~ /^#?(\d+)$/) {

RT::Interface::Web::Redirect(RT->Config->Get(‘WebURL’).“Ticket/Display.html?id=”.$1);

}

So any search item entered which solely consists of digits is never searched for but always forces a ticket lookup, this without any fallback to the Googlish search. This also means the code in Googlish.pm is never executed.

But correct me if I’m wrong or it’s called from other locations where this is taken into account.

Want to note that RT4 has better abstraction of simple search and it’s
easier to implement a new syntax there.

I’m aware; however there is no port yet; and rather stay away from x.0 releases out of experience.> On Wed, Jul 27, 2011 at 8:41 AM, Stijn Jonker sjcjonker@sjc.nl wrote:

Hi All,

Within our relatively new instance of RT 3.8.10 an custom field is created for the external ticket / reference number. Despite searches, possibly with wrong words, on RT-Users and the Wiki the following question still remains:

The normal search box above doesn’t return any matches on the “Ext Ticket #” custom field despite being a global custom field. When performing an query via the query builder searches for a ext ticket number, for instance 11111 works fine and the internal ticket 1030 is returned. When there we have an internal ticket which has the same ID as stored in an other ticket for the ext ticket # then the internal ticket is shown directly.

What we would like to do is present an special search box on the “RT at a glance” page where the search is solely performed on the custom field. Is there any way to do this with the base functions of RT or via an extension?

If this is not available, are there some pointers available how one can create, via a bit a perl or so, an item on the “RT at a glance” page with this search form that will populate a field in a saved search or otherwise?

Thanks in advance,
Stijn

Yours Sincerly / Met Vriendelijke groet,
Stijn Jonker

Ruslan & Others,

Take a look into index.html where that input box is processed
initially. There is a callback to analyze string and implement custom
action.

I did but, whatever I tried no success; I don’t want to scream bug, but maybe call this an undocumented feature… The issue is that I already modified the Googlish.pm module to add to the section:

for my $key (@keywords) {

   # Is this a ticket number? If so, go to it.
   # But look into subject as well
   if ( $key =~ m/^\d+$/ ) {
       push @id_clauses, "id = '$key'", "Subject LIKE '$key'", "CF.{ExtTicketId} LIKE '$key'";
   }

This looks good. Did you spell CF name properly. Use quotes around
CF.{…} if name contains fancy characters.

the “CF.{ExtTicketId} LIKE ‘$key’” item, but whatever I did when entering a numeric item it never found anything. Then I found in “Simple.html” the section:

if ($q =~ /^#?(\d+)$/) {

RT::Interface::Web::Redirect(RT->Config->Get(‘WebURL’).“Ticket/Display.html?id=”.$1);

}

This part is special. If you enter plain number then RT just tries to
load the ticket. It works for most people. In your case you should
disable this bit and do something tricky.

Just clean mason cache, stop and start web server and it should work.

So any search item entered which solely consists of digits is never searched for but always forces a ticket lookup, this without any fallback to the Googlish search. This also means the code in Googlish.pm is never executed.

But correct me if I’m wrong or it’s called from other locations where this is taken into account.

Googleish may be used in rt-crontool.

Want to note that RT4 has better abstraction of simple search and it’s
easier to implement a new syntax there.

I’m aware; however there is no port yet; and rather stay away from x.0 releases out of experience.

ok. Then you have to deal with whatever is in RT3.

Best regards, Ruslan.