- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2014 10:55 PM
Hi All,
We use the date value of "updated" field (global) for reporting (e.g. Finding incidents that are open but haven't been updated in a month), but I need to retrospectively correct a field on thousands of records that has been calculating incorrectly. I don't want the "updated" value to change just because I am correcting erroneous data. If I just run a simple script to fix the values, the update fields will all change, and all of the reports would not work anymore.
I looked for some sort of global business rule that manages the updating of this value, so I could briefly turn it off, but no luck.
Does anyone know a way of doing a mass update to a table without changing the "updated" field?
Thanks
Howard Elton
Service Transformation Manager
Synergy Energy
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2014 11:36 PM
Take a look at this great article on GlideRecords - http://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/
Look at the "setWorkflow" and "autoSysFields" methods in particular.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2014 11:36 PM
Take a look at this great article on GlideRecords - http://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/
Look at the "setWorkflow" and "autoSysFields" methods in particular.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2014 04:03 AM
Thanks very much for that!
So the key is to use "autoSysFields(false)" in you query like this:
//Change the category of all 'software' incidents to 'hardware' without updating sys fields
var gr = new GlideRecord('incident');
gr.addQuery('category', 'software');
gr.query();
while(gr.next()){
gr.category = 'hardware';
gr.autoSysFields(false);
gr.update();
}
Perfect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2014 06:05 AM
Correct. And I always use "setWorkflow(false)" as well just to make sure the update does not kickoff any other Business Rules that might send out an email, etc...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2017 12:33 PM
HI JIm
I had a similar request , the autoSysfield has not showing latest update in history log , audit . but i keep updating the details to update field( sys_updated_on)
we need , sys_updated_on not wants to update if any changes happened in the asset table last scan field