Brent Llewellyn
Mega Guru

Hi Manikandan,

 

The issue seems to be in your addQuery function. addQuery expects the following parameters: name, operator(optional), and value. In your script you are passing the query string. 

 

To use addQuery in your case it would look like this

gr.addQuery('state','NOT IN','6,7,8');

 

To use it in the query format you have you would need to use an addEncodedQuery which expects the actual query string which can be grabbed from a list view by right clicking the filter and closing "Copy query". 

To use addEncodedQuery in your case it would look like this

gr.addEncodedQuery('stateNOT IN6,7,8');

A working solution using addEncodedQuery would look like this

var gr = new GlideRecord('incident');
gr.addEncodedQuery('stateNOT IN6,7,8');
gr.query();
while (gr.next()) {
    gr.description = gr.description + '.';
    gr.update();
}

 

Thanks, 

Brent

 

If this helps please mark as helpful or correct so that others may benefit from this information as well.