Script Debugger exits when stepping over GlideRecord.insert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 11:47 AM - edited 01-19-2023 06:53 AM
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".
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 11:55 AM
I wonder if it's because you're missing the initialize() function.
Try adding gr.initialize(); after line 2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 12:08 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2022 02:02 PM
Any suggestion anyone?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 04:26 AM
Hi! Did you find the root cause for this?
I am facing the same issue.