Notifications

113 views

Issue


- Switch the system language to non-english eg: German

- Go to Service Portal and search for any keyword in the Typeahead Search Widget

eg: https://instancename.service-now.com/sp?id=search&q=mobile

Errors:

Server JavaScript error Cannot convert null to an object.
Line number 94
Script source code logged to browser console
Failing widget: 'Typeahead Search' (fa20ec02cb31020000f8d856634c9ce9)

(or)

Server JavaScript error Cannot convert null to an object.
Line number 69
Script source code logged to browser console
Failing widget: 'Search Page' (b8c57073cb10020000f8d856634c9cfc)

 

Symptoms


Check the system logs if there are errors as below:

org.mozilla.javascript.EcmaError: Cannot convert null to an object.
Caused by error in <refname> at line 46

43: while(m2mSearchSourceGR.next()) {
44: var searchSourceGR = m2mSearchSourceGR.getElement("sp_search_source").getRefRecord();
45: data.resultTemplates["sp-search-source-" + searchSourceGR.getValue("id") + ".html"] = $sp.translateTemplate(searchSourceGR.getValue("search_page_template"));
==> 46: getResults(searchSourceGR);
47: }
48: }
49:

java.lang.NullPointerException
Caused by error in sp_search_source.c96eb1686721220023c82e08f585efff.data_fetch_script at line 16
com.glide.catalog.cache.impl.DefaultTranslationProvider.getFieldTranslationsFromSysTranslated(DefaultTranslationProvider.java:231)
com.glide.catalog.cache.impl.DefaultTranslationProvider.access$300(DefaultTranslationProvider.java:29)
com.glide.catalog.cache.impl.DefaultTranslationProvider$FieldTranslationProvider.getTranslations(DefaultTranslationProvider.java:424)
com.glide.catalog.cache.impl.DefaultTranslations.getFieldTranslation(DefaultTranslations.java:80)
com.glide.catalog.cache.impl.ServiceCatalogI18NCacheableItemAdapter.resolveFieldValue(ServiceCatalogI18NCacheableItemAdapter.java:79)
com.glideapp.servicecatalog.Category.getTitle(Category.java:491)
com.glideapp.servicecatalog.Category.get(Category.java:137)
com.glideapp.servicecatalog.CatalogItem.getFirstAccessibleCategoryForSearch(CatalogItem.java:633)
com.glideapp.servicecatalog.scoped.api.CatalogItemJS.jsFunction_getFirstAccessibleCategoryForSearch(CatalogItemJS.java:316)
sun.reflect.GeneratedMethodAccessor1567.invoke(Unknown Source)

 

Enable debugging and check the debug logs:

[DefaultTranslationProvider] Loading translations for: table=sc_category, id=d258b953c611227a0146101fb1be7c31, language=en, source=sc_category
SQL04:17:34.776: Time: 0:00:00.000 for: caveriondev_2[glide.17] SELECT ... FROM (sc_category sc_category0 INNER JOIN sys_metadata sys_metadata0 ON sc_category0.`sys_id` = sys_metadata0.`sys_id` ) WHERE sc_category0.`sys_id` = 'd258b953c611227a0146101fb1be7c31' /*...*/ 
log04:17:34.778: [DefaultTranslationProvider] No db entry for: table=sc_category, id=d258b953c611227a0146101fb1be7c31, language=en, source=sc_category
log04:17:34.779: Evaluator: java.lang.NullPointerException Caused by error in sp_search_source.c96eb1686721220023c82e08f585efff.data_fetch_script at line 16 com.glide.catalog.cache.impl.DefaultTranslationProvider.getFieldTranslationsFromSysTranslated(DefaultTranslationProvider.java:231)

 

Cause and Solution


The issue is caused due to Catalog items pointing to Null Category.

Open "sc_cat_item" table and group by on field "Category"

If you see any catalog items with category as sys_id instead of a name, open it and check the value of the category. If it is pointing to Null, they are the ones causing the issue.

https://instancename.service-now.com/nav_to.do?uri=%2Fsc_cat_item_list.do%3Fsysparm_query%3Dcategory.titleISEMPTY%255Ecategory!%253DNULL%255EGROUPBYcategory%26sysparm_first_row%3D1%26sysparm_view%3D

Check the attached screenshots for reference.

To resolve the issue, make sure that there are no catalog items pointing to NULL category.

 

Article Information

Last Updated:2019-04-10 05:46:37
Published:2019-04-10
Screen Shot 2018-11-29 at 3.37.05 PM.pngScreen Shot 2018-11-29 at 3.37.36 PM.png