- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2019 04:44 AM
Hi All,
I am trying to do Mass update on my Gb Case using background script.
Everytime when I run the script it updates only one record how can i do mass update on 80000 records?
below is the script.
doUpdate();
function doUpdate()
{
var count= new GlideRecord('u_gbs_case_management');
count.addEncodedQuery('state=5^u_resolvedISEMPTY');
count.setLimit(10);
count.query();
if(count.next());
{
count.u_resolved = count.closed_at;
count.update();
}
}
any advice would be helpful.
Thanks and regards,
Meenal
Solved! Go to Solution.
- Labels:
-
Best Practices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2019 04:57 AM
Hi Meenal,
Use setWorkflow(false) command. it will help you to execute the command smoothly.
please go through the link for more details:
https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_GlideRecord-setWorkFlow_Boolean
Run the code in below format:
doUpdate();
function doUpdate()
{
var count= new GlideRecord('u_gbs_case_management');
count.addEncodedQuery('state=5^u_resolvedISEMPTY');
count.setLimit(10);
count.query();
if(count.next());
{
count.setWorkflow(false);
count.u_resolved = count.closed_at;
count.update();
}
}
Hope this will resolve your issue. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2019 04:57 AM
Hi Meenal,
Use setWorkflow(false) command. it will help you to execute the command smoothly.
please go through the link for more details:
https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_GlideRecord-setWorkFlow_Boolean
Run the code in below format:
doUpdate();
function doUpdate()
{
var count= new GlideRecord('u_gbs_case_management');
count.addEncodedQuery('state=5^u_resolvedISEMPTY');
count.setLimit(10);
count.query();
if(count.next());
{
count.setWorkflow(false);
count.u_resolved = count.closed_at;
count.update();
}
}
Hope this will resolve your issue. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2019 05:04 AM
Hi bint,
Still no luck.
I tried using setWorkflow() in my code, still it is updating single record at a time.
Thanks and Regards,
Meenal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2020 07:57 AM
Hi Meenal,
I had a background script that worked great in my dev instance but when I went to do it in test I ran into a similar issue. It would update one record and stop. I added setWorkflow(false) and it seemed to work when trying it in sandbox. What exactly does this do?
Regards,
Jay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2020 08:33 AM
setWorkflow(false) make sure that none of your business rule runs which is written on the table.
Thanks
Meenal