- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 02:12 PM
Hi,
I am creating an approval email notification where I need to display the values of a multi row variable set. I created an email script but is only returning the sys_id. So far this is what I have
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
//Name of my multi row variable set is remove_group_members
// Name of the variable is assignment_group
var mrvs =" ";
mrvs = current.sysapproval.variables.remove_group_members;
var rowCount = mrvs.getRowCount();
for (var i = 0; i < rowCount; i++) {
var row = mrvs.getRow(i);
template.print(row.assignment_group);
}
})(current, template, email, email_action, event);
Here an example
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 02:52 PM
Assuming the assignment_group variable within the MRVS is the type of reference, then that value will be stored as a sys_id which makes sense with what you are seeing. I don't think you can dot-walk within the MRVS results so you need to do a GlideRecord on the sys_user_group table where the sys_id = row.assignment_group, then from the returned record use the Name field. So something like this:
...
var row = mrvs.getRow(i);
var grp = new GlideRecord('sys_user_group');
grp.addQuery('sys_id', row.assignment_group);
grp.query();
if (grp.next()) {
template.print(grp.name);
}
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2022 06:25 AM
Hi Brad,
I will try, but I am not sure how.
Thanks for the suggestion.