- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2022 10:35 AM
I have create a catelog item. it has a dropdown variable which contains the name of some groups.
in the workflow notification how can i send mail to the groups which user select in the variable.
I tried the above, but not working..
Please help me
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2022 10:56 AM
Hey
Hope you are using Approval - Group activity
Try below code:
var grp = current.variables.group;
var gr = new GlideRecord("sys_user_group");
gr.addQuery("name", grp);
gr.query();
if(gr.next()){
answer.push(gr.getUniqueValue());
}
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2022 10:54 AM
Hi
try this script
var answer = [];
var arr = current.variables.group.toString().split(',');
for(var i=0; i<arr.length; i++)
{
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group',arr[i]);
gr.query();
while(gr.next())
{
answer.push(gr.user.toString());
}
}
Hope this helps
PLEASE MARK MY ANSWER CORRECT IF THIS HELPS YOU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2022 01:25 AM
How can i change the script, if the variable is a cmn_department reference filed.
And i want to send the mail to the users in the department

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2022 10:56 AM
Hey
Hope you are using Approval - Group activity
Try below code:
var grp = current.variables.group;
var gr = new GlideRecord("sys_user_group");
gr.addQuery("name", grp);
gr.query();
if(gr.next()){
answer.push(gr.getUniqueValue());
}
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2022 12:03 AM
How to push 2 groups ?
And also can you provide a solution if it is a department (cmn_department)
I want to send notification to a department