How to change search result redirect target

shawnbaar
Giga Expert

Hello,

We recently cloned the KB Category page in a service portal.  We are using the OOTB Homepage Search widget, and the only problem we have happens when the user selects one of the properly filtered results.  It directs the user back to the OOTB "kb_category" page rather than the new cloned page.  We have been able to clone/edit all of the other OOTB widgets to point to the new "cloned_kb_category" page, but have been unable to locate where to do this same redirect for the Homepage Search widget.  Can anyone point me in the right direction, please?

Thank you in advance if you are able to help.

Shawn

1 ACCEPTED SOLUTION

shawnbaar
Giga Expert

Thanks for responding Allen. 

I ended up having to adjust the code of a cloned typeahead search widget.  I first created a cloned copy of the OOB 'search' page so the resulting page would have the proper appearance and content.  The 'search' page is the default portal results page, so now I had to point everything to it. (This is a multi-tenancy instance so we always make client specific versions)

Next I had to clone the typeahead search widget and made the following adjustments:

Angular NG-templates tab in Related Links:   There are 2 typeahead templates which I cloned (sp-typeahead.html and sp-typeahed-popup.html).  I did this by creating new ones here and pasting in the code from the OOB originals

Body HTML template:

I changed the 'typeahead-template-url' to the newly cloned '<clonename>-sp-typeahead.html' and did the same for the popup template.

Server Script: (Note that this particular application only required the search function for knowledge on a public portal so there were no adjustments for other search types (incidents, service requests, etc).  There are multiple places in the OOB code that might need further adjusting for those)

(~ line 28 in OOB widget) data.typeaheadTemplates["<clonename>-sp-typeahead-" + searchGroupTemplatesGR.getValue("id") + ".html"]  This should point to your cloned typeahead template

(~ line 97 & 138 in OOB widget) item.templateID = "<clonename>-sp-typeahead-" + gr.getValue("id") + ".html";

(~line 160 in OOB widget) altered the 'result.url' to  "?id =<clonename>_" + pageID;  This is the page to which you want the selection of a search result to go. 

Client script:  (~ Line 29 in OOB widget) to point to the cloned 'search' page

You then need to change any search widgets that use the typeahead search widget as its base to point to the new <clonename>-sp-typeahead widget (usually found in the server script)

 

 

View solution in original post

3 REPLIES 3

Allen Andreas
Administrator
Administrator

Hi,

Please go to Service Portal > Service Portal Configuration in your back-end navigation:

find_real_file.png

Click Designer, and choose any page, doesn't matter. Once on that page's designer, in the top right corner click the "Edit Portal Properties" button:

find_real_file.png

Then change the knowledge home page to your new clone widget:

find_real_file.png

 

Otherwise, you'll need to go to Service Portal > Search Sources and look at the script there as that ultimately decides where the user goes.

 

Please mark reply as Helpful/Correct. Thanks!

 


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

shawnbaar
Giga Expert

Thanks for responding Allen. 

I ended up having to adjust the code of a cloned typeahead search widget.  I first created a cloned copy of the OOB 'search' page so the resulting page would have the proper appearance and content.  The 'search' page is the default portal results page, so now I had to point everything to it. (This is a multi-tenancy instance so we always make client specific versions)

Next I had to clone the typeahead search widget and made the following adjustments:

Angular NG-templates tab in Related Links:   There are 2 typeahead templates which I cloned (sp-typeahead.html and sp-typeahed-popup.html).  I did this by creating new ones here and pasting in the code from the OOB originals

Body HTML template:

I changed the 'typeahead-template-url' to the newly cloned '<clonename>-sp-typeahead.html' and did the same for the popup template.

Server Script: (Note that this particular application only required the search function for knowledge on a public portal so there were no adjustments for other search types (incidents, service requests, etc).  There are multiple places in the OOB code that might need further adjusting for those)

(~ line 28 in OOB widget) data.typeaheadTemplates["<clonename>-sp-typeahead-" + searchGroupTemplatesGR.getValue("id") + ".html"]  This should point to your cloned typeahead template

(~ line 97 & 138 in OOB widget) item.templateID = "<clonename>-sp-typeahead-" + gr.getValue("id") + ".html";

(~line 160 in OOB widget) altered the 'result.url' to  "?id =<clonename>_" + pageID;  This is the page to which you want the selection of a search result to go. 

Client script:  (~ Line 29 in OOB widget) to point to the cloned 'search' page

You then need to change any search widgets that use the typeahead search widget as its base to point to the new <clonename>-sp-typeahead widget (usually found in the server script)

 

 

thanks for this Shawn.