Error in very basic Glide Record Query

ruth3brown
Tera Contributor

I am using a background script to test a bit of code that is returning an error.   So I now have the most basic Glide Record query on the incident table that is still producing the error.   I can run the same code in the background script for other Task related tables so I think I have eliminated an error in the code.   But I don't know what to do next to find what is different about the incident table.   We have business rules running that use Glide Record queries on incident and we are not aware of any issue with those.

Please note that I won't have access to emails or this forum after today until Tues 10 October.   I am hoping I might get a result today.   But if not I will respond to your help and advice next Tuesday.

Code 1 on incident table generates Results 1 below:

var rec= new GlideRecord('incident');

rec.addActiveQuery();

rec.query();

gs.print('Records: ' + rec.getRowCount());

Results 1

[0:00:00.013] Script completed in scope global: script

Evaluator: java.lang.NullPointerException

    Caused by error in script at line 2

          1: var rec= new GlideRecord('incident');

==>     2: rec.addActiveQuery();

          3: rec.query();

          4: gs.print('Records: ' + rec.getRowCount());

sun.util.calendar.ZoneInfo.inDaylightTime(ZoneInfo.java:489)

com.glide.glideobject.GlideDateTime.getDSTOffset(GlideDateTime.java:305)

sun.reflect.GeneratedMethodAccessor326.invoke(Unknown Source)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

java.lang.reflect.Method.invoke(Method.java:498)

org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138).......

Code 2 on Requested Items table generates Results 2 below, I just changed table name:

var rec= new GlideRecord('sc_req_item');

rec.addActiveQuery();

rec.query();

gs.print('Records: ' + rec.getRowCount());

Results 2

[0:00:00.002] Script completed in scope global: script

*** Script: Records: 248

I get expected results for change_request, u_incident_task and task table.   It is only incident that generates the error.

1 REPLY 1

ruth3brown
Tera Contributor

I think I have answered my own question.   I have only just noticed that my background script is returning a number of records, but that output appears after all the nullpointerexception logs.   I just saw the error at the top and assumed the script had failed.



There is obviously the secondary issue of why the java.lang.NullPointerException is generated in the first place.   However this may be related to a known issue we have regarding the number of these errors in our logs.   So that is for another time.