Script Debugger exits when stepping over GlideRecord.insert

Bernhard Saile
Mega Guru

Hello,

 

I am experimenting with Script Debugger. In my test I am stepping through a Script Include creating two incident records. When I try to step over line 4 (gr.insert statement), the debugging session is stopped and the status message of the debugger switches to "WAITING_FOR_FIRST_BREAKPOINT".

 

createDummyIncidents.png

 

Looking at the Incident table, both Incidents DUMMY-1 and DUMMY-2 are created successfully, so the code beyond line 4 gets executed.

 

Is there a reason why this is happening? I was expecting that GlideRecord.insert is a simple synchronous database insert operation I can step over in a debugger?

 

Edit: After some months, I am resuming work on ServiceNow, and I still have this problem: we have a few complex script includes where more than one record gets inserted. The Debugger simply exiting at the first gr.insert call is quite annoying.

 

Can one of the ServiceNow experts confirm that this is a bug in Script Debugger or, if not, explain why this is happening?

7 REPLIES 7

Mike_R
Kilo Patron
Kilo Patron

I wonder if it's because you're missing the initialize() function.

Try adding gr.initialize(); after line 2.

 

Mike_R_0-1667850892296.png

 

Hi, thanks for the hint, but that doesn't make a difference. I added the initialize call in both my GlideRecord instances and started a new debugging session. Once I step over the first insert call, the debug session stops.

 

Anyway, with or without the initialize call both incident records are created successfully.

Bernhard Saile
Mega Guru

Any suggestion anyone?

Hi! Did you find the root cause for this?

I am facing the same issue.