
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2020 10:11 AM
When following the above example, the code below does not display any results:
(function(query, queryLocation, count) {
var results = [];
/* Calculate your results here. */
var userGR = new GlideRecord('sys_user');
userGR.addQuery('active', true);
userGR.addQuery('name', 'CONTAINS', query);
userGR.query();
userGR.setLocation(queryLocation - 1);
var resultCount = 0;
while(userGR.next() && resultCount < count + 1){
var obj = {};
obj.sys_id = userGR.getUniqueValue();
obj.primary = userGR.getDisplayValue();
obj.query_location = userGR.getLocation();
obj.label = userGR.getDisplayValue();
results.push(obj);
resultCount++;
}
if(results.length == 0)
return results;
if(results.length > count) {
results.pop();
} else {
// In order to indicate that a result in the result
// set is the final result (that there are
// no more results to be fetched), add this property
// to the final element in your result set.
results[results.length - 1].isLastResult = true;
}
return results;
})(query, queryLocation, count, facets);
The typeahead works but the results page does not.
Why is it not working?
Solved! Go to Solution.
- Labels:
-
Search
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2020 02:23 PM
The search facet needed to be enabled.
https://docs.servicenow.com/bundle/newyork-servicenow-platform/page/build/service-portal/task/enable-facets.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2023 04:22 PM
Did this get resolved?
Was a ticket opened with SeriveNow?
I spent a few hours thinking I was doing something wrong only to find this article later.
In addition, our company built a store app that needs a scripted search to work with paging.
Store apps are not allowed to make changes to global files.
So, b/c this wasn't working I had to do the following:
- Clone the Faceted Search Widget
- correct the line of code in the widget that isn't updating the page
- Clone the search page (we were using an OOTB page also)
- update to use the cloned Faceted Search Widget above
- Clone the Type Ahead Search Widget
- This has the search page to use hard coded in it
- Change our portal page to use the cloned type ahead search widget that directs users to the new cloned page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 12:52 PM
ServiceNow has informed us that this will be resolved in the Washington release.