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 03:17 AM
Yes i know it is for Description field. This is only updating for random 3 incidents

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 03:21 AM
Instead of update, can you print and check which records are matching your below condition.
gr.addEncodedQuery("active=true^stateNOT IN6,7,8");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 03:04 AM
I have upgraded to London instance recently. Not sure if it is because of the upgrade

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 03:10 AM
Hi
Can you try this once ?
var arr=".";
gr = new GlideRecord('incident');
gr.addQuery('stateNOT IN6,7,8');
//gr.setLimit(2);
gr.query();
while (gr.next())
{
arr += gr.description;
gr.description = arr;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2019 03:17 AM
Hi,
This is setting the same description for all incidents now.