Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

I need Refrence Qualifer for Variable set based on catalog item variable

rajibosss11
Tera Contributor

Hi,

Catalog variable field name : u_environment

select box: development,test.production

variable set Field name : server_list
lookup list: cmdb_rel_ci 
here i need to filter child list

and based on environment value i need to filter child server with environment filter 
if environment is development the this should only visible development servers in child list .
please some one suggest how to get this filter from Core catalog item variable to variable set.
thanks

2 REPLIES 2

vaishali231
Tera Guru

Hey @rajibosss11 

 

try this : 

Add a field on User record
Table: sys_user
Create a reference field:
u_notification_group ( Reference = sys_user_group)
Example:
User X - u_notification_group = T3

Update Notification (Important)
In Notification - Who will receive
Assignment group

Group members

Any “Users/Groups in fields”


Because those will send to everyone before your script.
Keep recipients empty

 

Use Notification Email Script (Template Script)
Email script

(function runMailScript(current, template, email, email_action, event) {

// Assignment group on ticket
var grp = current.assignment_group.toString();
if (!grp)
return;

// Get all members of that group
var grMem = new GlideRecord('sys_user_grmember');
grMem.addQuery('group', grp);
grMem.query();

while (grMem.next()) {

var userGR = new GlideRecord('sys_user');
if (!userGR.get(grMem.user))
continue;

// Skip inactive users
if (!userGR.active)
continue;

// Skip users without email
if (gs.nil(userGR.email))
continue;

// Only send if user's preferred notification group matches assignment group
if (userGR.u_notification_group == grp) {
email.addAddress("to", userGR.email.toString());
}
}

})(current, template, email, email_action, event);


To call this in notification body

${mail_script: email script name}


*************************************************************************************************************************************

If this response helps, please mark it as Accept as Solution and Helpful.

Doing so helps others in the community and encourages me to keep contributing.

 

Regards

Vaishali Singh

 

 

Tanushree Maiti
Giga Sage

Hi rajibosss11,

First tell me in under cmdb_rel_ci  there are two field. 

Child 

Parent

In child record (ci) table there is no Environment field 

In parent record (ci)table , there is Environment and used_for column. Please check & confirm in which column you are storing development,test.production environment values for your instance.

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