
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2010 02:03 PM
Is there a way to execute a background script (From Scripts - Background) that updates a record but does not run the business rules on that table?
For example, I have a new field on the Incident table that is a calculated field. However, the calculated value does not get set until the Incident is saved. I want to run a script that does an update on all existing Incident records, but I don't want to trigger any events or business rules as a result of the update.
var gr = new GlideRecord('incident');
gr.query();
while (gr.next()){
gr.update();
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2010 02:09 PM
You should be able to use the 'setWorkflow' method like this. It says to not run any business rules with the update.
var gr = new GlideRecord('incident');
gr.query();
while (gr.next()){
gr.setWorkflow(false);
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2011 07:37 AM
Thank you for the two great suggestions, Mark. They are certainly very helpful.
In addition to those I've learned from another experienced SN developer that gr.addNullQuery('field_name'); can be used to query records for empty fields more efficiently than gr.addQuery('field_name', '=', 'NULL');
Thanks again for the quick response!