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 02:17 AM
Hi Aarav,
Glad it helped Please mark the answer correct and close this thread.
How To Mark Answers Correct From Community Inbox

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017 02:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017 02:51 AM
Although this has been answered, one option that wasn't explored was to create an array of the incident numbers then loop through them, parsing each one.
It may be more process-intensive, but it looked like the objective here was to make life easier for the programmer writing code for a one-off task.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017 01:40 AM
We can try like,
var incnum = 'INC0010240,INC0010234,INC0010233,INC0010200,INC0010214,INC0010211,INC0010209,INC0010208,INC0010207,INC0010206,INC0010204,INC0010203,INC0010202,INC0010201';
var incnumarray = incnum.split(',');
var abc= new GlideRecord('incident');
for(var i = 0; i < incnumarray.length; i++){
if(abc.get('number', incnumarray[i].trim()))
gs.print(abc.active);
}