- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 08:04 AM
Hello,
I have to update multiple records in scoped app but when i tried to update record using updateMultiple(), it is not working.
Script :
var gr = new GlideRecord('x_hclan_gbs_financ_p2p_request');
gr.addEncodedQuery("numberINP2P6688772,P2P6689407,P2P6689784,P2P6690341,P2P6690659");
gr.query();
gr.state = 7;
gr.work_notes="We are closing this ticket as per the request through the story : STRY0163997";
gr.updateMultiple();
Please suggest what is wrong in the script.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 12:25 AM
Hey, I think the updateMultiple does not work with Journal entries.
you will have to loop through and update each record.
updateMultiple()
Updates each GlideRecord in a stated query with a specified set of changes.
This method does not support adding multiple journal entries.
Note: To ensure expected results, use the setValue() method instead of direct assignments. That is, use gr.setValue('<field_name>', '4')); instead of gr.<field_name> = 4.
Note: Do not use this method with the chooseWindow() or setLimit() methods when working with large tables.
This method sets new values and does not clear existing values. To clear an existing value, use the setValue() method and set the field to null.
If this helps, please mark the answer correct/helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 12:13 AM
1. Please check getrowcount
2. If count is there and it will not work then add your code in Try Catch block. You will get exact error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 12:25 AM
Hey, I think the updateMultiple does not work with Journal entries.
you will have to loop through and update each record.
updateMultiple()
Updates each GlideRecord in a stated query with a specified set of changes.
This method does not support adding multiple journal entries.
Note: To ensure expected results, use the setValue() method instead of direct assignments. That is, use gr.setValue('<field_name>', '4')); instead of gr.<field_name> = 4.
Note: Do not use this method with the chooseWindow() or setLimit() methods when working with large tables.
This method sets new values and does not clear existing values. To clear an existing value, use the setValue() method and set the field to null.
If this helps, please mark the answer correct/helpful.