Continuation of script to next line

aarav
Kilo Contributor

Hi Friends.

I have to close many Incidents . i am doing it by script by hardcoding them.

Like

var chn = new GlideRecord('incident');

chn.addQuery('number','IN','INC0051502,INC0051172,INC0051088,INC0051334');   like this i have to provide some 500 incidents.

The above statement is working for 4 incidents.But how to hardcode 500 incidents .

Like

chn.addQuery('number','IN','INC0051502,INC0051172,INC0051088,INC0051334',                                                                                                    

INC0051502,INC0051172,INC0051088,INC0051334,INC0051502,INC0051172,INC0051088,INC0051334,

INC0051502,INC0051172,INC0051088,INC0051334');

The above statement is showing error as i not providing end of line and start of line symbols/commands ..

Please let me know how to continue to next line.

Thank you very much in advance.

regards

Aarav

13 REPLIES 13

Harsh Vardhan
Giga Patron

do you have any unique fields value in these incidents. eg: state is close or assignment group is "hardware".



if you have then you can do addQuery() on that field.


Thank u Harsh.



I coded every thing and working fine for 1 line command/script.


But i have many incidents that goes to 4-5 line.How to continue the command to next line.?


like


var chn = new GlideRecord('incident');


chn.addQuery('number','IN','INC0051502,INC0051172,INC0051088,INC0051334');



Aarav


it will work make sure you dont have space there in



var abc= new GlideRecord('incident');


abc.addQuery('number','IN','INC0010240,INC0010234,INC0010233,INC0010200,INC0010214,INC0010211,INC0010209,INC0010208,INC0010207,INC0010206,INC0010204,INC0010203,INC0010202,INC0010201');


abc.query();


while(abc.next())


{


gs.print(abc.active);


}




find_real_file.png


mate it's time consuming effort. check the proper space between these incidents else it will not work


Thank you Harsh.



Its worked fine for me..


I tried many options but missed that.


Thanks again.


Aarav.