Updating 40K records Comments on sysapproval_approver table using background script

srivasareddyy
Tera Contributor

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.

 

5 REPLIES 5

Midilesh
Tera Contributor

Hi Srini,

Can you share your Background script here so that I can review it

srivasareddyy
Tera Contributor
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();
 }

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();
}

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.