gr.update() not working

Manikandan2
Kilo Expert

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. 

16 REPLIES 16

Omkar Mone
Mega Sage

Hi 

Have you tried updateMultiple instead of update?

No updateMultiple also did not work

Ajaykumar1
Tera Guru

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

Have already tried this. it did not work