How to fix com.glide.ui.ServletErrorListener source error ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2021 02:45 AM
Hi All,
While check the error in the system logs, i am getting "Root cause of JavaScriptException: java.lang.NullPointerException
: java.lang.NullPointerException:" error whose source is com.glide.ui.ServletErrorListener.
Code:-
JavaScript evaluation error on:
var data_string = source.u_whendisabled;
//convert date in .OZ format to sting
var when_disabled = data_string.substring(0,4)+'-'+data_string.substring(4,6)+'-'+data_string.substring(6,8)+' '+data_string.substring(8,10)+':'+data_string.substring(10,12)+':'+data_string.substring(12,14);
//set date based on US/Eastern time zone
var gDate = GlideDateTime();
gDate.setValue(when_disabled);
///substract offset based on time zone between UTC and US/Eastern
var offset = gDate.getTZOffset();
gDate.add(offset);
answer = gDate;
Root cause of JavaScriptException: java.lang.NullPointerException
: java.lang.NullPointerException:
Can some help me where can i find this this , whats the issue in this code and how can we resolve this?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2021 03:46 AM
Can you check value of "when_disabled" variable before this gDate.setValue(when_disabled).
I suspect there is some issue in line 2 code
var when_disabled = data_string.substring(0,4)+'-'+data_string.substring(4,6)+'-'+data_string.substring(6,8)+' '+data_string.substring(8,10)+':'+data_string.substring(10,12)+':'+data_string.substring(12,14);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2021 03:49 AM
This i found in the sys_transform_entry as a source script. the field u_whendisabled i mapped to user table AD disabled field. I think beacuse AD disabled is empty in the source table because of this error will come. am i right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2021 04:05 AM
Its might be, the value is coming empty. You can always check by applying gs.log(source.u_whendisabled) or gs.info(source.u_whendisabled) in your script.
and
instead of directly passing value you can use check the value
var data_string = source.u_whendisabled;
//convert date in .OZ format to sting
if(data_string!=''){
var when_disabled = data_string.substring(0,4)+'-'+data_string.substring(4,6)+'-'+data_string.substring(6,8)+' '+data_string.substring(8,10)+':'+data_string.substring(10,12)+':'+data_string.substring(12,14);
//set date based on US/Eastern time zone
var gDate = GlideDateTime();
gDate.setValue(when_disabled);
///substract offset based on time zone between UTC and US/Eastern
var offset = gDate.getTZOffset();
gDate.add(offset);
answer = gDate;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2021 04:14 AM
var data_string = source.u_whendisabled;
//convert date in .OZ format to sting
if(source.u_whendisabled!="")
{
var when_disabled = data_string.substring(0,4)+'-'+data_string.substring(4,6)+'-'+data_string.substring(6,8)+' '+data_string.substring(8,10)+':'+data_string.substring(10,12)+':'+data_string.substring(12,14);
//set date based on US/Eastern time zone
var gDate = GlideDateTime();
gDate.setValue(when_disabled);
///substract offset based on time zone between UTC and US/Eastern
var offset = gDate.getTZOffset();
gDate.add(offset);
answer = gDate;
}
i have added "if(source.u_whendisabled!="")" in my code. is code looks ok now?