typeahead search widget, calling in a new widget suggestions is not working

s_dinesh01
Tera Expert

Hi,

 

i did call the typeahead search widget into a new widget, im able to see the widget and works when i add text and click enter its giving me all the results related to the wording.

but the suggestions when i type in word is not working, i did add the 'Contextual Search Sources' with in the Instance options of the widget with catalogs and Knowledge bases even then suggestion is not working.

 

Thanks in advance 

2 REPLIES 2

AyushKumarM
Mega Guru

Hi @s_dinesh01 ,

  • Check your widget options first.

    • In the instance options of your new widget, the option for contextual search sources should be named exactly sources.

    • Make sure you’ve actually pointed it to the right search sources (like KB or Catalog). Small things like casing or wrong option name can silently break the binding.

  • Double-check your search sources in Contextual Search.

    • Go to Contextual Search > Search Sources and confirm your sources (KB, Catalog) are active, pointing to the correct tables, and not restricted by conditions.

    • Also, check if they’re mapped to the portal you’re testing on — typeahead won’t work if the portal isn’t linked.

  • Open your browser dev tools and look at the network tab.

    • Start typing in your widget. You should see calls firing to /api/now/sp/search.

    • If no call goes out → your input isn’t wired correctly to the typeahead directive.

    • If a call goes out but comes back empty → then it’s your search source config that needs adjusting.

  • Compare with the out-of-the-box Typeahead Search widget.

    • Drop the OOB one into the same page. If it works there, then your custom widget is missing something.

    • Most likely, the HTML template is missing the sp-typeahead directive. The OOB one looks like this:

       
      <input type="text" ng-model="data.q" sp-typeahead="sources" placeholder="{{::options.placeholder}}">

      Without that directive, suggestions won’t show up.

  • Other things to keep in mind:

    • Typeahead is context-aware, so make sure your page is actually part of a Service Portal that has contextual search enabled.

    • Check ACLs — if the user can’t read KB or Catalog tables, suggestions won’t return results even though hitting enter works.

Lastly, ensure your widget instance includes the contextual search option.

My quick fix approach if I were in your shoes:

  • Add the OOB Typeahead widget right next to your custom one and compare.

  • If OOB works → copy its HTML and client script into your widget, then slowly re-customize.

  • Watch the network calls while typing — that tells you immediately whether it’s a binding issue (no call) or a data issue (empty response).


    If this answer worked, please mark it as the solution. A helpful mark is also appreciated—it helps others in the community.

    Thanks and Regards,

    Ayush

     









 

 

kaushal_snow
Mega Sage

Hi @s_dinesh01 

 

It often comes down to search suggestions being disabled or mis configured search sources (Contextual Search Sources) on that page (so while pressing Enter returns results, live suggestions don’t), for example, ServiceNow has a system property for enabling suggestions in Typeahead as well as the glide.service_portal.search_as_you_type_behavior property (e.g. Select Suggestions / Typeahead behavior) that must be set correctly for suggestions to appear....

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/