JavaScriptException: java.lang.NullPointerException in logs

Jay81
Tera Guru

Hi,

 

Getting bellow error in logs close to 300 daily. Please assist.

=================

JavaScript evaluation error on:

(function executeRule(current, previous /*null when async*/) {


var glideURI = gs.action.getGlideURI().toString();


if (glideURI.indexOf("angular") >-1){


current.contact_type='self-service';


}


})(current, previous);

Root cause of JavaScriptException: java.lang.NullPointerException
: java.lang.NullPointerException:

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Jay,

are you sure the logs are coming because of above script shared?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

This is what I see in System log=> Errors

 

find_real_file.png

Hi Jay,

the below method works well in global and scope app as well; so I don't think any issue here

gs.action.getGlideURI().toString();

Is that a before BR which tries to set the contact_type as self_service if the url contains angular?

What are the log timings?

Can you add try catch block to check exception

try{

var glideURI = gs.action.getGlideURI().toString();

if(glideURI.indexOf('angular') > -1){

current.contact_type = 'self_service';

}

}

catch(ex){

gs.info('Exception is: ' + ex);

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I have disabled the business rules since they are not required. Now I'm not getting the errors.