gr.update() not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 02:48 AM
Hi,
gr = new GlideRecord('incident');
gr.addQuery('stateNOT IN6,7,8');
gr.query();
while (gr.next()) {
gr.description = gr.description + '.';
gr.update();
}
The above is a small code i am writing to update all open incidents(anything except Resolved, Closed, Cancelled) state with a " . " in the description
When i run this query in the scripts background it is randomly updating only few tickets and it is not updating all tickets.
I am not sure what wrong i am doing here. What change should i make in this query to update all the incidents.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 02:54 AM
Hi
Have you tried updateMultiple instead of update?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 03:01 AM
No updateMultiple also did not work

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 02:55 AM
Hi Manikandan,
Try below script.
var gr = new GlideRecord('incident');
gr.addEncodedQuery("active=true^stateNOT IN6,7,8");
gr.query();
while (gr.next()) {
gr.description = gr.description + '.';
gr.update();
}
Regards,
Ajay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 03:03 AM
Have already tried this. it did not work