Fix Script not pausing at Debug Break Points
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
Please reference the attachment.
I have Breakpoints set on every statement in the script.
I start debugger, opens separate window - then from original window, I run fix Script (not in background).
Script completes without ever pausing for a breakpoint (and does not set my reports publish=false)
Help Please
StacyLen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
Hi @stacylen196,
Looks like someone asked the exact same question in the past - Debugger is not stopping in the breakpoint in Fix ... - ServiceNow Community
Hope that helps, cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Saturday
Hi @stacylen196 ,
The debugger will not work in a fix script. If you want to debug your code, you can run it in a background script and add gs.info() statements after the lines you want to debug. In fix script also you can use try/catch to check the error message.
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I found Google AI shows the same script:
var gr = new GlideRecord('sys_report');
gr.query();
while (gr.next()) {
// Use getValue() to check the field's current value
var isPublic = gr.getValue('public');
if (isPublic == 'true') {
// Use setValue() to change the field's value
gr.setValue('public', 'false');
gr.update();
gs.info("Report '" + gr.getValue('title') + "' (sys_id: " + gr.getUniqueValue() + ") set to private.");
}
}However, there is no field named 'public' on the sys_report table. So that script changes nothing in my instance. However, there is the 'is_published' field and a 'roles' field, where 'public' is shown. That combination seems to allow "public" access to the report.
