- 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 08:38 AM
That was I looking for, many thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2020 08:45 AM
Glad it worked

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2020 04:51 AM
Hi Miro,
You can send parameters from the task to the email notification using these to values.
For example, you can send the ticket's number, or assigned to, or comments, depends on what you need.
The command used to do this is the command used to create an event.
Example:
In a business rule, you can add this command:
gs.eventQueue('incident.manager.reminder', current, current.number, gs.getUserName());
gs.eventQueue - adds an event to System Logs -> Events
incident.manager.reminder - is the name of the event
current.number - refers to the number of the task the business rule is running on - this is parm1
gs.getUserName() - gets the username of the one who generated the event - this is parm 2
So when you open the event in System Logs -> Events, you can see parm1 and parm2, such as INC0036577 and John.Doe, respectively.
You can then use the events in an email notification:
If you send the reciepient in parm1, you can check in tab "Who will receive" Event parm 1 contains recipient.
Or you can use it inside the notification itself: ${event.parm1}
More here: http://wiki.servicenow.com/index.php?title=Events_and_Email_Notification#gsc.tab=0
Please mark correct or helpful if this helps.
Thanks
Swapnil