
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2023 12:09 AM - edited ‎12-10-2023 12:15 AM
Prepare the multi-row variable set (MRVS) "cc_users" in the Service Catalog.
The variable set "cc_users" contains the variable "user_email".
A user sets up multiple email addresses in the "cc_users" form in the Service Catalog.
You want to add these email addresses to the CC of the email notifying the user that the Service Catalog (e.g. the Catalog that creates the RITM) has been processed.
I am trying, but when I look at the actual email notifying users, the CC field remains empty.
How do I script the Email?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2023 01:46 AM - edited ‎12-10-2023 02:11 AM
Hi @Community Alums ,
You can use below script to get varibles in MVRS
var mrvs = current.variables.mrvsVariableName; // give here name of mrvs
var arr = [];
var parser = JSON.parse(mrvs);
for(var i=0;i<parser.length;i++){
var user = new GlideRecord("sys_user");
user.addQuery("sys_id", parser[i]);
user.addQuery("email","!=","");
user.query();
while(user.next()){
arr.push(user.email.toString()); // give here name of email variable
email.addAddress("cc", arr, user.getDisplayValue());}}
}
Use the above logic in mail script and call it in your Notification using ${mail_sctipt:MailscriptName}
Mark it helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2023 01:46 AM - edited ‎12-10-2023 02:11 AM
Hi @Community Alums ,
You can use below script to get varibles in MVRS
var mrvs = current.variables.mrvsVariableName; // give here name of mrvs
var arr = [];
var parser = JSON.parse(mrvs);
for(var i=0;i<parser.length;i++){
var user = new GlideRecord("sys_user");
user.addQuery("sys_id", parser[i]);
user.addQuery("email","!=","");
user.query();
while(user.next()){
arr.push(user.email.toString()); // give here name of email variable
email.addAddress("cc", arr, user.getDisplayValue());}}
}
Use the above logic in mail script and call it in your Notification using ${mail_sctipt:MailscriptName}
Mark it helpful and solution proposed if it serves your purpose.
Thanks,
Anand

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2023 03:10 AM
I tried to create the script you gave me, but the CC is still empty. Where is the cause and how can I fix it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2023 04:57 AM
Hi @Community Alums,
Put logs check what exactly you are getting in arr variable.
Thanks,
Anand