- 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
07-12-2016 06:11 PM
Hello,
I know this post is marked as answered, but I found myself having to dig quite a bit to find out how to do this via a Transform Map. So Im piggy-backing this thread in order to spread some knowledge.
Edit: I have found and confirmed a very simple solution that is scalable:
I have confirmed that you can update system fields such as sys_updated_by and most other sys_ fields using a Transform Map with minimal Script. My instance is currently a Fuji release.
1. Create your Transform Map like normal with your source table, target table, and all of your fields mapped like normal.
2. Check the "Run business rules" box so that it remains unchecked.
3. Check the "Run script" box so that it remains checked.
4. In the script box make sure to add:
- //Make sure update is only done on existing records
- if ( action == "insert") {
- ignore = true;
- }
- /* Disable SN from auto updating sys_fields */
- //Needed in order to leave historical information unchanged
- target.autoSysFields(false);
- //Disable the running of business rules that might normally be triggered by SN.
- target.setWorkflow(false);
5. At the bottom left, in the Field Maps tab/list, create a new field map
Create a new mapping from your target import table to your sys_ field that you want to update
6. Save, upload your data, and run your transform.
Hope that helps someone out there!
You can also find a method using Glide Records here: https://community.servicenow.com/thread/162539