- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2020 01:03 AM
Hi
I've got two different notification and workflow using two Run scripts
In the first run script I store callers in array and using parm1 to send emails to them.
Second run script collects some records as a parm2 and should send email to the same callers like parm1.
Anyone knows how to deal with it? How to use parm1 from first run script to the second one?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2020 04:58 AM
Hi,
Then use this code
Thanks,
var recList = [];
var queryString = 'type=normal';
var gr = new GlideRecord("change_request");
gr.addEncodedQuery(queryString);
gr.query();
while (gr.next()) {
recList.push(gr.sys_id + '');
}
var abc = workflow.scratchpad.parameter1;
var spl = abc.split(',');
for (var i = 0; i < spl.length; i++) {
gs.eventQueue('rec_list', null, spl[i], recList);
}
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2020 04:09 AM
HI,
You are not using recList[i]
Use as below
gs.eventQueue('rec_list', null, workflow.scratchpad.parameter1, recList[i]);
One more thing:
for (var i = 0; i < recList.length; i++) {
gs.eventQueue('rec_list', null, workflow.scratchpad.parameter1, recList);
}
According to the length of the recList it will send email. If you want one email then dont use this above forloop just use the event line.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2020 04:24 AM
That's not what I meant, I need scratchpad iteration

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2020 04:39 AM
HI,
So in param 1 you need single email id and in param 2 whole recList?
Is this true, if no then explain?
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2020 04:41 AM
that's right, in the second script parm1 should be single sys_id and parm2 should be array of recList

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2020 04:58 AM
Hi,
Then use this code
Thanks,
var recList = [];
var queryString = 'type=normal';
var gr = new GlideRecord("change_request");
gr.addEncodedQuery(queryString);
gr.query();
while (gr.next()) {
recList.push(gr.sys_id + '');
}
var abc = workflow.scratchpad.parameter1;
var spl = abc.split(',');
for (var i = 0; i < spl.length; i++) {
gs.eventQueue('rec_list', null, spl[i], recList);
}
Thanks,
Ashutosh