- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 05:40 AM
Hi All,
I am trying to update thousand record using background script. Script is working fine but it updates only one record instead of thousand. Please see the code in attachment and provide solutions, if anyone faced this type of issue.
Thanks,
Tara Singh
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 11:15 AM
Hi @Tarasingh26 ,
updateMultiple() doesn't work in scoped application, would suggest using standard update() function here, it should work just fine.
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 11:16 AM
Hi @Tarasingh26 ,
updateMultiple() doesn't work in scoped application, would suggest using standard update() function here, it should work just fine.
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 12:36 PM
Hi @Tarasingh26 ,
Hope you are doing great.
Instead of using update multipe use update function. also please try usig below script :
var gr = new GlideRecord("sn_risk_advanced_legal_entities");
gr.query();
while (gr.next()) {
var gr1 = new GlideRecord("cmn_cost_center");
gr1.addQuery('u_gl_company_code', gr.u_entity_code);
gr1.setLimit(100);
gr1.query();
while (gr1.next()) {
gr1.u_legal_entity = "ABC";
gr1.setWorkflow(false);
gr1.update();
}
}
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 09:02 AM
which table you need to update cost center or risk?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 10:45 AM
I want to update cost centre table based upon GL company code and legal entity field . GL company code in table 1 = Legal entity field in another table2.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 11:15 AM
Hi @Tarasingh26 ,
updateMultiple() doesn't work in scoped application, would suggest using standard update() function here, it should work just fine.
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 11:16 AM
Hi @Tarasingh26 ,
updateMultiple() doesn't work in scoped application, would suggest using standard update() function here, it should work just fine.
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 09:25 PM
Thanks Aman Kumar. It is also working. Thanks for help. Really struggled with this issue in past few days.