- 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-31-2024 08:50 AM
Thank you so much Sanjay! This is exactly what I needed. =D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2024 10:29 AM
@kmolson73 You are Welcome 😇