- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 09:46 AM
I think I have most of the components to have this work but i'm missing something.
I have workflow triggering an event to fire an notification. The event contains a parameter script to get a list of email addresses from a list of users from a list collector. I can generate the array no problem.
Create Event activity:
(function() {
var arrayEmail = [];
var gr = new GlideRecord('sc_req_item');
gr.addQuery('number', current.sys_id);
gr.query();
if (gr.next()) {
var arrayUtil = new ArrayUtil();
var list = gr.variables.proj_employee_remove_list.toString();
var arrayList = list.split('.');
l = arrayList.length;
for (var i=0; i<=l; i++) {
var ue = new GlideRecord('sys_user');
ue.addQuery('sys_id', 'IN', arrayList[i]);
ue.query();
while (ue.next()) {
arrayEmail += (ue.email + ',');
}}
return "arrayEmail";
}
}());
The problem is passing the email addresses to the notification. I have the parameter 1 selected in the notification. The event fires but returns the RITM that's associated with workflow. What else am i missing or doing incorrectly?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 01:41 PM
Looks like I had an error with the first part of the query. It should have been a 'sys_id', current.sys_id
Second, the parameter needs to pass the sys_id of the users so the second half of the script was wholly unnecessary.
I'm not sure if the toString at the end is necessary since it's already in a string format but it didn't hurt.
Thanks for the suggestions!
(function() {
var arrayEmail = [];
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', current.sys_id);
gr.query();
if (gr.next()) {
var arrayUtil = new ArrayUtil();
var list = gr.insertvariablename.toString();
var arrayList = list.split(',');
l = arrayList.length;
return arrayList.toString();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 10:25 AM
I'm not using eventQueue anywhere. I thought the parm1 would send that over to the notification.
If I were to use it, where would I add this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 10:33 AM
I misread, sorry about that. Since this is a workflow 'Create Event' activity, you can ignore my comments about gs.eventQueue().
If you pull up one of the event log records in detail, what does it look like?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 11:18 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 10:53 AM
I would suggest using the Run script activity and calling gs.eventQueue();
That should work fine.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 01:41 PM
Looks like I had an error with the first part of the query. It should have been a 'sys_id', current.sys_id
Second, the parameter needs to pass the sys_id of the users so the second half of the script was wholly unnecessary.
I'm not sure if the toString at the end is necessary since it's already in a string format but it didn't hurt.
Thanks for the suggestions!
(function() {
var arrayEmail = [];
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', current.sys_id);
gr.query();
if (gr.next()) {
var arrayUtil = new ArrayUtil();
var list = gr.insertvariablename.toString();
var arrayList = list.split(',');
l = arrayList.length;
return arrayList.toString();
}