- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 08-17-2022 07:17 AM
(function() {
var table1 = new GlideRecord('x_table_1');
table1.addEncodedQuery('copy Query from show/hide filter'); // This is optional if you want to filter for specific records in a large table to save time.
table1.query();
while (table1.next()) {
var table2 = new GlideRecord('x_table_2');
table2.addEncodedQuery('copy Query from show/hide filter'); // This is optional if you want to filter for specific records in a large table to save time.
table2.query();
while (table2.next()) {
// If there is a common field between the two tables use that. In my case a child and parent relationship
if (table1.u_field_x == table2.u_field_y) {
var table3 = new GlideRecord('x_table_3');
table3.setValue('u_field_1', table1.getUniqueValue('u_reference_field'));
table3.setValue('u_field_2', table1.u_string_field);
table3.setValue('u_field_3', table2.getDisplayValue('u_name_field'));
}
}
}
})();