Updating 40K records Comments on sysapproval_approver table using background script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 01:23 AM
Hi ,
When I try updating comments on 10k records using a query with a set limit on the sysapproval_approver table, it's taking more than 5 minutes.
Can anyone suggest a way to update 40k records within 5 minutes?"
We are disabling few notifications and business rules while running the before Background script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 01:26 AM
Hi Srini,
Can you share your Background script here so that I can review it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 01:48 AM
var rej = filtercondition; // state = approved or state = rejected
var gr = new GlideRecord('sysapproval_approver');
gr.addEncodedQuery(rej);
gr.setLimit(10000);
gr.query();
while(gr.next()) {
gr.comments = 'test';
gr.autoSysFields(false);
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 03:47 AM
Add a line so the no Business Rules run with the update
var rej = filtercondition; // state = approved or state = rejected
var gr = new GlideRecord('sysapproval_approver');
gr.addEncodedQuery(rej);
gr.setLimit(10000);
gr.query();
while(gr.next()) {
gr.comments = 'test';
gr.autoSysFields(false);
gr.setWorkflow(false);
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 04:46 AM
Hello Brad,
Thank you for your response. The 'comments' field is a journal input data type. If we set setWorkFlow('false'), the comments are not updating in the mentioned table; they are instead updating in the journal inputs storage table.