Add Dynamic Fields search in Fulltext ToolBarTicketSearch

English! place to talk about development, programming and coding
Post Reply
kkleo
Znuny newbie
Posts: 1
Joined: 12 Dec 2012, 13:02
Znuny Version: 3.1.11
Real Name: Kogia Kleopatra
Company: GSIS

Add Dynamic Fields search in Fulltext ToolBarTicketSearch

Post by kkleo »

I am new in OTRS and Perl Programming.
I would like to ask if there is a way to enrich the FullText Search Attributes.
As I have understood the OTRS FullText Search in the Toolbar searches for the given value in attribute fields - From To Cc Subject Body and TicketID - of a Ticket.

OTRS\Kernel\Modules\AgentTicketSearch.pm

my $TicketID = $Self->{TicketObjectSearch}->TicketIDLookup(
TicketNumber => $GetParam{Fulltext},
UserID => $Self->{UserID},
);
if ($TicketID) {
return $Self->{LayoutObject}->Redirect(
OP => "Action=AgentTicketZoom;TicketID=$TicketID",
);
}
}

# prepare full text search
if ( $GetParam{Fulltext} ) {
$GetParam{ContentSearch} = 'OR';
for (qw(From To Cc Subject Body)) {
$GetParam{$_} = $GetParam{Fulltext};
}
}


I would like to make it search on the ticket's Dynamic Fields created by the user.

I have seen that search on a Dynamic Field can be done in the GlobalSearchNav by creating a Search Profile where a Dynamic Field can be added to the Search Attributes through SysConfig' s module Ticket -> Frontend::Agent::Ticket::ViewSearch.

Is there a way to add a Dynamic Field in the search attribute fields of the Fulltext search module in Toolbar?

Could this be done through the SysConfig panel or should i have to change the code in the OTRS\Kernel\Modules\AgentTicketSearch.pm ( Agent Search Router for OTRS ), OTRS\Kernel\System\TicketSearch.pm, OTRS\Kernel\Output\HTML\ToolBarTicketSearchFulltext.pm ...

Thanks in advance for your time
juanman80
Znuny newbie
Posts: 44
Joined: 11 Nov 2011, 10:30
Znuny Version: 5.0.15

Re: Add Dynamic Fields search in Fulltext ToolBarTicketSearc

Post by juanman80 »

I think I would try to use the already existing functionality of searching in DynamicFields:

Code: Select all

if ( $GetParam{Fulltext} ) {
    for (qw(From To Cc Subject Body)) {
        $GetParam{$_} = $GetParam{Fulltext};
    }
    $GetParam{DynamicField_FieldNameX}->Like = $GetParam{Fulltext};
}
FieldNameX being the name of the dynamic field you want to search... if there are more than one DF:

Code: Select all

if ( $GetParam{Fulltext} ) {
    for (qw(From To Cc Subject Body)) {
        $GetParam{$_} = $GetParam{Fulltext};
    }
    for my $DF ( qw( X Y Z ) ){
        $GetParam {'DynamicField_' . $DF }->Like = 
            $GetParam{Fulltext};
    }
}
where X, Y and Z are the names of the DF's you want to search...
But be careful, full text search is commonly used and this addition may harm your performance.
OTRS 5.0.15 on CentOSLinux with MariaDB database connected to an Active Directory for Agents and Customers.
MisterShelby
Znuny newbie
Posts: 11
Joined: 13 Sep 2019, 19:15
Znuny Version: 6.0

Re: Add Dynamic Fields search in Fulltext ToolBarTicketSearch

Post by MisterShelby »

Any idea how that works with an OTRS 6 installation?
Post Reply