JavaScriptException: java.lang.NullPointerException in logs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2020 03:41 AM
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2020 03:55 AM
Hi Jay,
are you sure the logs are coming because of above script shared?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2020 04:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2020 04:10 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2020 04:50 AM
I have disabled the business rules since they are not required. Now I'm not getting the errors.