Adding MVRS to Assignee Notification When Task is Assigned to a Group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi Experts,
I’m trying to enhance my notification setup by adding MVRS (Multi-Value Record Set) details to the notification sent to assignees, specifically when a task is assigned to a group.
The goal is to ensure that assignees can clearly see the relevant MVRS information directly in the notification itself.
Has anyone implemented this before or can provide guidance on how to include MVRS data in such notifications? Any tips, best practices, or examples would be greatly appreciated.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @saint
You can add the MRVS into your email as a table format by adding your logic(extract the JSON data, parse it and loop through each ) in the email script to format into a table.
sample logic:
//change variable names accordingly
var mvrs = current.variables.mrvs_name;
mvrs = JSON.parse(mvrs);
template.print('<table >');
template.print('<tr>');
template.print('<th>Column 1 Header</th>'); // Replace variable label
template.print('<th>Column 2 Header</th>'); // Replace variable label
template.print('</tr>');
for (var i = 0; i < mvrs.length; i++) {
//table rows
template.print('<tr>');
template.print('<td>' + parser[i].variable_one_name + '</td>'); // Replace variable
template.print('<td>' + parser[i].variable_two_name + '</td>');
template.print('</tr>');
}
template.print('</table>');
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
5x ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
44m ago
Hi @saint
Try this:
Step 1: Create the Notification Email Script
- Navigate to System Notification > Email > Notification Email Scripts and click New.
- Set the Name (like mrvs_data).
(function runMailScript(current, template, email, email_action, event) {
var mrvs = current.variables.mrvs_internal_name; //Replace with actual MRVS name
if (mrvs) {
try {
var parser = JSON.parse(mrvs);
if (parser.length > 0) {
template.print('<b>MVRS Details:</b><br/>');
template.print('<table border="1"><tr><th>Variable 1</th><th>Variable 2</th></tr>');
for (var i = 0; i < parser.length; i++) {
var row = parser[i];
template.print('<tr><td>' + row.var1 + '</td><td>' + row.var2 + '</td></tr>');
}
template.print('</table>');
}
} catch (e) { gs.log('Error parsing MVRS'); }
}
})(current, template, email, email_action, event);
2: Add the Script to Your Notification
- Add ${mail_script: mrvs_data} to the Message HTML body.
3: Configure Assignment Conditions
- In When to send, set conditions (e.g., Assignment group | changes).
- In Who will receive, select the Assignment group
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti