Service Portal Service Catalog script errors

VJ4
Giga Expert

Hello guys,

I'm getting four errors when using forms in ServiceCatalog in SP (Helsinki - Patch 6).

The errors are;

Server JavaScript error Cannot convert null to an object.

Line number 25

Script source code logged to browser console

Failing widget:

And the below in the SN logs.

java.lang.NullPointerException: java.lang.NullPointerException: com.glide.data_lookup.catalog.CatalogDataLookup.getDefinitionsWithClientScriptForItem(CatalogDataLookup.java:59)

com.glide.ui.ng.catalog.NGCatalogDataLookupProcessor.getCatalogLookupsForItem(NGCatalogDataLookupProcessor.java:67)

com.glide.ui.ng.catalog.NGCatalogDataLookupProcessor.getCatalogDataLookups(NGCatalogDataLookupProcessor.java:60)

com.glide.ui.ng.catalog.NGCatalogDataLookupProcessor.process0(NGCatalogDataLookupProcessor.java:35)

com.glide.ui.ng.catalog.NGCatalogProcessorBase.process(NGCatalogProcessorBase.java:29)

com.glide.ui.ng.AngularProcessor.process(AngularProcessor.java:115)

com.glide.processors.AProcessor.runProcessor(AProcessor.java:412)

com.glide.processors.AProcessor.processTransaction(AProcessor.java:187)

com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:165)

com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:49)

com.glide.sys.ServletTransaction.run(ServletTransaction.java:34)

java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

java.lang.Thread.run(Thread.java:745)

I read few threads about this issue and changed the Catalog Client Script UI Type to 'Both' but no joy.

Has anyone found a solution to this at all?

Thanks in advance.

9 REPLIES 9

ChrisBurks
Mega Sage

Viraj,



The error means that somewhere around line 25 in the script the variable is empty where the script is expecting there to be an object. Therefore it can't dot walk out to the desired value.


For example if there is a var named "item" that should contain an object with a property called "name" and in the script it needs to walk out to that "name" property: item.name


If "item" doesn't actually contain the object then it can't walk out to the property. Thus creating an error "Can't convert null to an object." In other words I can't dot walk out to the property "name" because "item" has a value of null.



This may not be the exact case but the point is that the variable is expecting to be used as an object is some manner but the value is empty.



You'll need to walk through the script (it points out that it's breaking near line 25) and figure out why the variable is not getting assigned anything.


Hi Chris,



Thanks for your reply. However, I haven't touched any scripting side of things of SP and this error has been there since we switched on SP with Helsinki. I've seen users raising this error before and wondered if it had to do with UI scripts on these forms that are no more functioning in Service portal?



Regards.


Did you find solution for this? I am even getting the same error but for some users not all.



Thanks


Hiran


Hiya,



The issue we had with our instance was due to a limitation in the My Request widget,if I remember correctly. Please note that this was in the Helsinki release so not sure if it's been addressed now. We were getting errors for service catalog items that were not associated with a RITM so had to modify the Server Script like below. (Line numbers 9 -17.)



while (gr.next()) {


if (recordIdx == options.maximum_entries)


break;



var record = {};


record.sys_id = gr.getValue('sys_id');


var ritm = new GlideRecord("sc_req_item");


ritm.addQuery("request", gr.getUniqueValue());


ritm.query();



if (ritm.getRowCount() == 0){


//continue;


record.display_field = gr.getDisplayValue("short_description");


}



else if (ritm.getRowCount() > 1){


record.display_field = gs.getMessage("{0} requested items", ritm.getRowCount());


}



else {


ritm.next();


record.display_field = ritm.cat_item.getDisplayValue() || ritm.getDisplayValue("short_description");


}



record.secondary_fields = [];


data.secondary_fields.forEach(function(f) {


record.secondary_fields.push(getField(gr, f));


});



record.url = {id: 'sc_request', table: 'sc_request', sys_id: record.sys_id};


data.list.push(record);


recordIdx++;


}