Notifications

15 views

Symptoms


Advanced typeahead search was not working as expected on the service portal. Observed below error in the browser console,

Error: newUrl.url is not a function
api.controller/c.onSelect@typeahead-search.js:14:38
fn@https://xxxx.service-now.com/scripts/js_includes_sp.jsx?v=09-20-2018_1514&lp=Mon_Aug_13_01_08_48_PDT_2018&c=29_446 line 13095 > Function:4:460
scope.select@https://xxxx.service-now.com/scripts/js_includes_sp.jsx?v=09-20-2018_1514&lp=Mon_Aug_13_01_08_48_PDT_2018&c=29_446:46330:1
fn@https://xxxx.service-now.com/scripts/js_includes_sp.jsx?v=09-20-2018_1514&lp=Mon_Aug_13_01_08_48_PDT_2018&c=29_446 line 13095 > Function:4:352
initializeBinding/destination[scopeName]...

Release


Any supported release. 

Cause


Below type-ahead widget code was failing,

if ($item.target)
window.open($item.url, $item.target);
else {
var newUrl = $location.url($item.url);
spAriaFocusMan******ager.navigateToLink(newUrl.url());
}


This was due to the reason that url is undefined in $item object and hence type ahead search link didn't work and throws java script error.

Resolution


As per the following document,
https://docs.servicenow.com/bundle/london-servicenow-platform/page/product/knowledge-management/concept/conf-service-portal-know-management.html#conf-url-km-article-view-page , 

add the below line of code into the "Knowledge Base" widget and it should resolve the issue.

article.url='?id=kb_article_view&sys_kb_id=' + article.sys_id;

Additional Information


Service portal

Service portal search

Article Information

Last Updated:2018-11-07 01:14:32
Published:2018-11-07