- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2018 06:35 AM
Hello Experts,
I'm trying the script below to force update ALL records so the calculated field values gets written in the database, so then I can filter/sort on the calculated fields to run proper reports. The problem I'm having with the background script below is that it keeps saying 'running transaction' for a long time before I end up clicking 'Cancel'.
Any thoughts on how I can update the table to force update all the records to save the calculated values to the DB?
var gr = new GlideRecord('change_request');
gr.query();
while (gr.next()) {
gr.setForceUpdate(true);
gr.autoSysFields(false);
gr.setWorkflow(false);
gr.update();
}
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2018 06:54 AM
Hi Brown,
I would suggest you to use fix script since using this will allow you to check the status in background. This fix script can run in background and you can monitor that using Progress Workers under System Diagnostics.
https://docs.servicenow.com/bundle/kingston-application-development/page/build/applications/concept/c_FixScripts.html
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2018 08:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2018 08:30 AM
Hi Brown,
Fix scripts are available for global applications as well.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2018 02:26 PM
Hi Ankur,
From what I understand, I can keep the basic code for the Fix Script, is that correct? Can you help me with the Fix Script please, never created one, so want to make sure I'm doing this correctly.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2018 11:38 PM
Hi Brown,
Type fix scripts in left navigation. Open table create new
mention the script and that's it. Once you save it you will get a related link to run that script. After that you can execute it in foreground or proceed in background.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2018 06:22 AM
Hi Ankur,
Okay so I created the Fix script with the same script I posted before, do I need to make any changes to my code? When I go to execute it, I get this warning: Warning! Fix scripts may add, update, and delete data, including rules and scripts. They may also change property settings. Back up data before proceeding.
Is there any concern here for what I'm trying to do? I've never came across such warning running a schedule job or a background script.
Thanks