Passing through Catalog variable in workflow event param 1 to populate the who gets a notification

wiganmichae
Tera Contributor

Hi,

I have a catalog item that has 2 variables I would like to pass through the workflow with 2 different events and populate who get the notification.

The first variable they select a support group (assignment group) and want that groups manager passed through for the email notification.

The second is a lookup list of sys_user and I just want that list of selected users passed through the notification.

I've tried version of the script below in Event parameter with no success.

(function() {
answer = [];

answer.push(current.variables.platform_support_group.manager);
	return "";
}());

 

(function() {
answer = [];

answer = current.variables.individual_notificaitons.toString().split(',');
	return "";
}());



4 REPLIES 4

Tanushree Maiti
Kilo Patron

Hi @wiganmichae 

 

Hope this scripts from workflow ,

comment this line and try

// return "";

 

And do some null checking like 

 

(function() {
answer = [];
if(current.variables.platform_support_group.manager){
answer.push(current.variables.platform_support_group.manager);
}

}());
Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

The individual one is working fine now and passing through but the support group manager is still a no go if I comment out the return line or use the suggested script.

Ankur Bawiskar
Tera Patron

@wiganmichae 

how are you sending the email? are you using workflow email activity?

share some screenshots

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I'm using workflow to generate an event that sends notification, we went that way to have more control over how the notification is used and also be available to other items. 

The notification has a list of emails that it goes to also push through the manager of the support group selected from the catalog variable.