Issue with background script output page

KS86
Tera Contributor

Hi all,

 

Actually I am wondering why I am getting like this on output page(See screenshot). Lot of Unnecessary things, I just want to print the sys_ids of created incidents. In the background those incidents were created.

Is something enabled in my instance? earlier I don't used get this. 

What should I do? Please assist.

KS86_0-1783482335383.png

KS86_1-1783482365990.png

 

3 REPLIES 3

AednaR
Tera Expert

Hi @KS86 ,

The screenshot strongly suggests SQL debugging is enabled for your session, either directly in ServiceNow or through the SN Utils extension.
try:
  • Disable all Session Debug options.
  • Reopen a fresh browser tab.
  • and run the code again

Sarthak Kashyap
Mega Sage

Hi @KS86 ,

 

There are some jobs that are running in backend and you are just getting the log message, there is nothing wrong in the instance, you can ignore them and you can check incident table the incident is created successfully

 

SarthakKashyap_0-1783487396252.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

 

Anand__99
Kilo Sage

Hi @KS86 ,

 

You are logging "grInc.sys_id" which is returning GlideElement object.

Use "grInc.getValue("sys_id")" OR "grInc.getUniqueValue()" OR "grInc.sys_id.toString()"

 

Avoid using this method to retrieve values, this creates issues while you are pushing values to the array. Every element references the last return value.

 

You're logging grInc.sys_id, which returns a GlideElement object.

Instead, use any one of the following:

  • grInc.getValue("sys_id")
  • grInc.getUniqueValue()
  • grInc.sys_id.toString()

Avoid accessing field values directly (for example, grInc.sys_id) as these returns GlideElement object and create issues if try to use array to store and fetch values, all elements references the same object. 

 

Thanks

Anand