
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-12-2018 04:06 AM
I have a catalog item that has a variable (select box) that contains a list of names. In addition, I have an email notification baked inside of the workflow. What I am trying to do is send the email notification to person that is selected in that select box. Is this something that can be accomplished?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-12-2018 04:24 AM
Hi
Can try this
answer = [];
answer.push(current.variable.variable_name);
Regards
Guru

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-17-2018 06:24 AM
Good day to you,
I am just now getting back to this. The select box is not a reference field.
Is there a way to do this without it being a reference field?
Thanks,
Karen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-17-2018 07:14 AM
Hi Karen,
Yes you can still do this with just the name but you're going to have to use that name to glide into the user table and retrieve the sys_id because that's what you need to pass to the workflow activity. Have a go with the script below and confirm what is in the gs.logs. You should get an array of names (firstname+lastname) and then and array of sys_id's.
answer = [];
var arrAppr = current.variables.u_approver.split(",");
gs.log('this is the array: ' + arrAppr);
for (var i = 0; i < arrAppr.length; i++) {
var gr = new GlideRecord('sys_user');
gr.addQuery('name', arrAppr[i]);
gr.query();
while(gr.next()){
answer.push.(gr.getValue('sys_id'));
}
gs.log('this is the answer: ' + answer);
cheers
Dave

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-17-2018 07:38 AM
Hi David,
I figured it out. I just needed to change the field to a reference field only showing those users and then the script below did the trick.
answer = [];
answer.push(current.variables.variable_name.sys_id);
Thank you for responding so quickly.
Have a great weekend.
Karen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-17-2018 07:44 AM
Glad you got it working, have a good one š
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-12-2018 07:54 AM
add a gs.log to see what the value of your arrAppr is returning. If it's already a list of sys_id's you might not even need the for loop. If you do need the loop you'll need to get rid of the rogue colon in there
answer = [];
var arrAppr = current.variables.u_approver.split(",");
for (var i = 0; i < arrAppr.length; i++) {
answer.push.(arrAppr[i].toString());
}