
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2020 02:06 AM
Hi
I have a multi row variable set and there is data in the columns. Does anyone have any idea how can i display that table in notification?
I am using email script wherein i am calling the variables via GlideAppVariablePoolQuestionSet, but unable to get the multi row variable?
Is there any way possible?
or may be some columns in it?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2020 03:36 AM
that's correct.
If you are using any reference variable inside MRVS you will get sys_id and not the display value
you will have to query the reference table with that sys_id and get the display value.
Something like this
Updated in bold is the change
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var req_id = current.sysapproval;
template.print('<p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><strong>' + req_id.number + '</strong>');
template.print(' : ' + req_id.short_description + ' <br /> <br />');
//print variables
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(req_id);
set.load();
var vs = set.getFlatQuestions();
if (vs.size() > 0) {
template.print('<strong>Request Item Variables:</strong><br /><br />');
for (var i = 0; i < vs.size(); i++) {
var show_line = 'true';
if (vs.get(i).getLabel() == 'Line Manager Approval required?' || vs.get(i).getLabel() == 'Line Manager') {
show_line = 'false';
}
if (vs.get(i).getLabel() == 'AD Action') {
var ritmGR = new GlideRecord('sc_req_item');
if (ritmGR.get(req_id)) {
gs.log("Entered into the IF conditon of AD Action");
template.print('<table>');
template.print('<th>Name</th><th>Email</th><th>Department</th>');
var mrvs = ritmGR.variables.ad_management_multirow; //check and put correct name
var rowCount = mrvs.getRowCount();
gs.log("print mrvs " + mrvs);
gs.log("Row count of MRVS length " + rowCount);
for (var s = 0; s < rowCount; s++) {
var row = mvrs.getRow(s);
var displayDepartmentValue = getActualValue('cmn_department', row.user_department);
template.print("<tr>");
template.print("<td><center>" + row.user_name + "</center></td>"); //check fieldname
template.print("<td><left>" + row.user_email + "</left></td>"); //check fieldname
template.print("<td><left>" + displayDepartmentValue + "</left></td>"); //check fieldname
template.print("</tr>");
}
template.print('</table>');
}
}
if (vs.get(i).getLabel() != '' && vs.get(i).getLabel() != null && show_line == 'true' && vs.get(i).getDisplayValue() != '' && vs.get(i).getLabel() != 'AD Action') {
template.space(4);
template.print('<strong>' + vs.get(i).getLabel() + "</strong>: " + vs.get(i).getDisplayValue() + "<br />");
}
}
}
function getActualValue(table, value){
var gr = new GlideRecord(table);
gr.addQuery("sys_id", value);
gr.query();
if (gr.next()) {
return gr.getDisplayValue();
}
}
})(current, template, email, email_action, event);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2020 04:17 AM
Hi Chenab,
Please check if this article is helpful.
https://hi.service-now.com/kb_view.do?sysparm_article=KB0743684
Regards,
Monika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2020 04:23 AM
you will have to use email script in your notification.
sharing link for help
How to display MRVS table in Approval Notification Email
Cannot print Multi Row Var set on Email notifications
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2020 07:15 AM
Did you get a chance to check on the link shared?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2020 01:56 AM
Tried the script but the table doesn't appear correctly and also i am not able to see the data