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
04-17-2024 04:38 AM
Could you please include both the breakpoints in your script indicating where it should start and stop? I can see only one breakpoint in your script. I typically follow this approach when debugging large scripts. It provides clear instructions to the debugger about which portion of the script needs to be executed
Probably this will helps you to resolved your issue. Let me know in case you need to understand the flow or you can DM on LinkedIn.
If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.
Best Regards,
Krushna Birla
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 04:46 AM
I eventually found a solution that worked for me: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1637446
Basically, create a new system property "glide.ua.gcf.sample_priority.enabled" and set it to false.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 11:46 PM
Hello.
What you see in the Screenshot is not a Breakpoint, but the current location while stepping through the script execution line by line.
Stepping over gr.insert in line 4 simply leaves the debug session and resumes script execution. If, for example, there is a breakpoint in line 7, it is simply ignored and the script gets executed anyway.