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 07:58 AM
Yes that should print the number of records. I would recommend testing a fix script that updates a lot of records in a sub-production instance first.
Also look into using update multiple rather than looping through each record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 10:36 AM
I just tried to run this and the row count was not printed. Am I missing something?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 10:39 AM
You have an extra ) at the end of your log line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2020 10:47 AM