Continuation of script to next line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017 12:49 AM
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
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017 01:04 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017 01:10 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017 01:17 AM
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);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017 01:18 AM
mate it's time consuming effort. check the proper space between these incidents else it will not work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017 01:58 AM
Thank you Harsh.
Its worked fine for me..
I tried many options but missed that.
Thanks again.
Aarav.