- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2025 01:33 AM
Hello every one,
I need to send a notification from a RITM (with an email script) containing mutiple values in a List collector of a MVRS, I've got some issue.
I have a MRVS with 2 Lists collector :
In the notification, it works when only 1 user/profile is selected in each row with this code :
for (var i = 0; i < rowCount; i++) {
template.print("<tr>");
var row = mrvs.getRow(i);
template.print("<td>" + getName(row.collaborateur_test.toString(),'sys_user') + "</td>");
template.print("<td>" + getName(row.profil_test.toString(),'question_choice') + "</td>");
template.print("</tr>");
But when mutiple users or profile are selected in the same row, it doesn't work (return "Undefined", like the example below) :
Any idea ?
Ps : sorry for my bad english and my lack of knowledge in code.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2025 08:44 AM
the reason it's working is because for the 1st row it has only 1 user
In the 2nd row there are more than 1 sysIds and hence it's breaking
update the getName() function as this and it will work for sure
function getName(sys_id, tblName) {
var arr = [];
var rec = new GlideRecord(tblName);
rec.addQuery('sys_id', 'IN', sys_id.toString());
rec.query();
while (rec.next()) {
arr.push(rec.getDisplayValue());
}
return arr.toString();
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2025 07:16 AM
@Niels Toulorge Try this update set, I believe I have handled all type of variables here:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2025 08:45 AM
Thanks for feedback @RaghavSh. The result seems a bit weird with your US :
It mixes the 2 lists Selector for one variable but not for the other.
RITM :
Notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2025 09:08 AM
@Niels Toulorge Thats strange, it should behave same for both variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2025 08:04 AM
it looks like it's working but due to some query business rule on table the display value is getting blocked?
did you add gs.info() and see?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2025 08:41 AM - edited 10-17-2025 08:46 AM
Here is a gs.log of my mrvs :
[ {
"collaborateur_test" : "90038c1b4755b150da43d352e36d43c2",
"profil_test" : "30c0dae587feae1061d4ec6e8bbb3501"
}, {
"collaborateur_test" : "c5ee7f8b4791b150da43d352e36d4342,15af7bcf4791b150da43d352e36d43f5",
"profil_test" : "a63b77b887feaa1061d4ec6e8bbb35a9,59bc6ab087f6aa1061d4ec6e8bbb351c"
} ]So it works if I have a single choice in my list collector, but not with multiple sys_id values.
