- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 12:04 PM
We currently have a record producer that contains a multi row variable set with different types of variables in it. We have an HTML field on the record that the labels and values get passed to in table form when the record producer is submitted. It works great, except we recently added a list collector field (type_of_activity_vs) to the multi row variable set and I am only getting the sys_ids for the values for that field in my table. I'm trying to figure out what I need to add to my script below to be sure I get the values rather than the sys_ids.
Record producer script:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 03:27 PM - edited 07-30-2024 03:28 PM
Hi @kmolson73 ,
Can you please try the below code in your script-
// Create Table for the Additional Transaction Details
var htmlInfo = '<p></p><table style="border-collapse: collapse; width: 100%; height: 26px;" border="1"><tbody><tr style="height: 13px;"><td style="width: 33%; height: 13px;"><strong>Type of Activity</strong></td><td style="width: 33%; height: 13px;"><strong>Date of Transaction</strong></td><td style="width: 33%; height: 13px;"><strong>Account Number</strong></td><td style="width: 33%; height: 13px;"><strong>Amount</strong></td><td style="width: 33%; height: 13px;"><strong>Transaction Details</strong></td>';
var rowcount = producer.additional_transaction_details.getRowCount();
for (var rc = 0; rc < rowcount; rc++) {
var row = producer.additional_transaction_details.getRow(rc);
// Fetch the display value for the list collector field
var typeOfActivity = [];
var typeOfActivityIds = row.type_of_activity_vs.split(','); // Split the list collector values
var typeOfActivityGR = new GlideRecord('your_list_collector_table'); // Replace with your actual table name
typeOfActivityGR.addQuery('sys_id', 'IN', typeOfActivityIds);
typeOfActivityGR.query();
while (typeOfActivityGR.next()) {
typeOfActivity.push(typeOfActivityGR.getDisplayValue('display_field')); // Replace 'display_field' with the appropriate field
}
// Handle single or multiple values
var typeOfActivityDisplay = typeOfActivity.length > 1 ? typeOfActivity.join(', ') : typeOfActivity[0];
htmlInfo += '<tr style="height: 13px;"><td style="width: 33%; height: 13px;">' + typeOfActivityDisplay + '</td><td style="width: 33%; height: 13px;">' + row.date_of_transaction_vs + '</td><td style="width: 33%; height: 13px;">' + row.account_number_vs + '</td><td style="width: 33%; height: 13px;">' + row.amount_vs + '</td><td style="width: 33%; height: 13px;">' + row.transaction_details_vs + '</td></tr>';
}
htmlInfo += '</tbody></table>';
current.more_transaction_details = htmlInfo;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 12:22 PM
Hi @kmolson73
check if the below links help:
https://www.servicenow.com/community/developer-forum/passing-multi-row-variable-set-values-to-a-list...
https://www.servicenow.com/community/developer-forum/how-to-pass-multi-row-variable-set-values-to-a-...
https://www.servicenow.com/community/developer-forum/list-collector-in-multi-row-variable-set-workar...
https://www.servicenow.com/community/itsm-forum/list-collector-in-multi-row-variable-set/m-p/428443
…………………………………………........................................................................................
Mark it helpful 👍and Accept Solution ✅!! If this helps you to understand.
…………………………………………........................................................................................
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 12:45 PM
Thank you, Satishkumar. I will give these a try and respond if I get it working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 12:48 PM
@kmolson73 Sure.
…………………………………………........................................................................................
Mark it helpful 👍and Accept Solution ✅!! If this helps you to understand.
…………………………………………........................................................................................

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 03:27 PM - edited 07-30-2024 03:28 PM
Hi @kmolson73 ,
Can you please try the below code in your script-
// Create Table for the Additional Transaction Details
var htmlInfo = '<p></p><table style="border-collapse: collapse; width: 100%; height: 26px;" border="1"><tbody><tr style="height: 13px;"><td style="width: 33%; height: 13px;"><strong>Type of Activity</strong></td><td style="width: 33%; height: 13px;"><strong>Date of Transaction</strong></td><td style="width: 33%; height: 13px;"><strong>Account Number</strong></td><td style="width: 33%; height: 13px;"><strong>Amount</strong></td><td style="width: 33%; height: 13px;"><strong>Transaction Details</strong></td>';
var rowcount = producer.additional_transaction_details.getRowCount();
for (var rc = 0; rc < rowcount; rc++) {
var row = producer.additional_transaction_details.getRow(rc);
// Fetch the display value for the list collector field
var typeOfActivity = [];
var typeOfActivityIds = row.type_of_activity_vs.split(','); // Split the list collector values
var typeOfActivityGR = new GlideRecord('your_list_collector_table'); // Replace with your actual table name
typeOfActivityGR.addQuery('sys_id', 'IN', typeOfActivityIds);
typeOfActivityGR.query();
while (typeOfActivityGR.next()) {
typeOfActivity.push(typeOfActivityGR.getDisplayValue('display_field')); // Replace 'display_field' with the appropriate field
}
// Handle single or multiple values
var typeOfActivityDisplay = typeOfActivity.length > 1 ? typeOfActivity.join(', ') : typeOfActivity[0];
htmlInfo += '<tr style="height: 13px;"><td style="width: 33%; height: 13px;">' + typeOfActivityDisplay + '</td><td style="width: 33%; height: 13px;">' + row.date_of_transaction_vs + '</td><td style="width: 33%; height: 13px;">' + row.account_number_vs + '</td><td style="width: 33%; height: 13px;">' + row.amount_vs + '</td><td style="width: 33%; height: 13px;">' + row.transaction_details_vs + '</td></tr>';
}
htmlInfo += '</tbody></table>';
current.more_transaction_details = htmlInfo;