How to get number of records updated in fix script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 07:55 AM
Hello,
I have a simple fix script. After the update, I want to alert how many records were updated. How can I do this?
flagIncident();
function flagIncident() {
var actIncGR= new GlideRecord('incident');
actIncGR.addEncodedQuery('priority=4^sys_created_onONLast year@javascript:gs.beginningOfLastYear()@javascript:gs.endOfLastYear()');
actIncGR.query();
while (actIncGR.next()) {
actIncGR.setWorkflow(false);
actIncGR.autoSysFields(false);
actIncGR.active = false;
actIncGR.update();
}
gs.info("# of incident(s) updated: " + actIncGR.getRowCount()));
}
Does the below do what I need it to do?
There are thousands of records, so I do not want to BOG the system down and therefore am hesitant to try it.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 10:48 AM
It should print the number of records that were found for that query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 11:00 AM
I'm not getting anything when I execute the fix script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 11:05 AM
can you just run the following in a background script?
flagIncident();
function flagIncident() {
var actIncGR = new GlideRecord("incident");
actIncGR.addEncodedQuery("priority=4^sys_created_onONLast year@javascript:gs.beginningOfLastYear()@javascript:gs.endOfLastYear()");
actIncGR.query();
gs.info("# of incident(s) updated: " + actIncGR.getRowCount());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 11:11 AM
I don't get the info message at the top. I only get the output displayed after the fix script is ran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 11:50 AM
I was looking at the progress worker. Sorry my fault