Adding values from a multi row variable set to an email notification

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 09:35 PM
I am trying to add the values from a multi row variable set and I'm just not having any luck.
I've had a look at these:
- how to show variable set values in notification - ServiceNow Community
- Solved: Display Multi row variable set columns in notifica... - Page 3 - ServiceNow Community
The one I've tried is:
How to Display Multi Row Variable set (MRVS) data... - ServiceNow Community
My MRVS is as follows:
Internal Name: other_items
Type: Multi Row
Layout: 1 Column Wide
I only have one variable within the MRVS
Name: other_options
Type: Single Line Text
My current mail script is:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// This sets the font size and type
var mrvs = current.variables.other_items; // MRVS Internal name
var rowCount = mrvs.getRowCount();
if (rowCount >= 1) {
template.print("<table border =1>");
template.print("<tr>");
template.print("<th>Others</th>");
template.print("</tr>");
for (var i = 0; i < rowCount; i++) {
template.print("<tr>");
var row = mrvs.getRow(i);
template.print("<td>" + getName(row.others.toString(),'current.variables.other_options') + "</td>");
template.print("</tr>");
}
template.print("</table>");
}
//This function accept sys_id and table and returns the Display name.
function getName(sys_id, tblName) {
var rec = new GlideRecord(tblName);
if (rec.get(sys_id)) {
return rec.getDisplayValue();
}
}
})(current, template, email, email_action, event);
All it is returning is the table border and heading, no variable values
What am I missing.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 07:10 PM
Thank you for sharing your code, I have had a look at it now on a couple of occasions and I just don't see how I edit it to get the values from my MRVS?
If you are able to assist with that I'd be very appreciative.