Send notification to user selected in list collector

Nisha28
Tera Contributor

Hello All,

I have requirement to send the notification to all those user which are selected in list collector on catalog task.

This notification should trigger when the task is closed complete .

I have tried this sending the notification through workflow attached to catalog item 

and in the notification script  i used below code .but it is not sending the notification but when selected one user in To field it is sending the notification but for below code it is not working

answer = current.variables.responsible_service_managers.toString().split(',');

Thanks 

 

1 ACCEPTED SOLUTION

Hi Nisha,

I totally missed you were trying to use a catalog variable.  In this case you can create an async business rule on the sc_task table that triggers when the catalog task is closed complete.  The business rule will then create an event for the email notification.

ref: Setup email notification using Business rule.

example business rule:

find_real_file.png

find_real_file.png

View solution in original post

5 REPLIES 5

Jon23
Mega Sage

Can you create a new notification that triggers when the sc_task is closed complete and use your list collector field in the 'who will receive > users/groups in field'?


find_real_file.png

Nisha28
Tera Contributor

Hello Jwalton,

 

I tried above solution but I am not able to get the variable in who will receive.

 

Hi Nisha,

I totally missed you were trying to use a catalog variable.  In this case you can create an async business rule on the sc_task table that triggers when the catalog task is closed complete.  The business rule will then create an event for the email notification.

ref: Setup email notification using Business rule.

example business rule:

find_real_file.png

find_real_file.png

Nisha28
Tera Contributor

I have used below script in business rule and it is working fine 

 

(function executeRule(current, previous /*null when async*/) {
var memberships = current.variables.responsible_service_managers.toString().split(",");
var serviceManagers = [];
for(var i=0; i<memberships.length; i++) {
var grMember = new GlideRecord('sys_user_grmember');
if (grMember.get(memberships[i])) {
serviceManagers.push(grMember.user.toString());
}
}
gs.eventQueue('servicemanager.email', current, gs.getUserID(), serviceManagers.toString());

})(current, previous);