The CreatorCon Call for Content is officially open! Get started here.

How to send mail to a group using workflow notification script ?

Beast
Tera Contributor

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.

find_real_file.png

find_real_file.png

I tried the above, but not working..

 

Please help me

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

Hey @Beast 

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 🙂

 

Best Regards
Aman Kumar

View solution in original post

8 REPLIES 8

Muhammad Khan
Mega Sage

Hi,

 

If there is only 1 group then you can use the below script.

var answer = [];

answer.push(current.variables.group.toString());

 

If there are multiple groups then you can utilize the below script.

var answer = [];

var arr = current.variables.group.toString().split(',');
for(var i=0; i<arr.length; i++){
	answer.push(arr[i].toString());
}

I tried the first script, not working

Try configuring a couple of things as shown in the images below.

 

These outbound and inbound email configuration should be check as per requirement.

find_real_file.png

Change Include Members to True.

find_real_file.png

Specify group email.

find_real_file.png

Yousaf
Giga Sage

Hi Beast,

This has some good answers you may have to modify things a little.

Send notification from workflow

 

Mark Correct or Helpful if it helps.


***Mark Correct or Helpful if it helps.***