Hello Everyone

Anvesh Reddy123
Tera Contributor

I have two fields requested for(reference) and devices (list collector)
My requirement is to auto populate requested for assigned devices(from hardware table  ) in devices field. Please help me with the solution. 

5 REPLIES 5

Yashsvi
Kilo Sage

Hi @Anvesh Reddy123,

Use this script:

// Replace placeholders with actual field and table names
var hardwareGR = new GlideRecord('YourHardwareTable');
hardwareGR.addQuery('assigned_to', current.requested_for);  // Replace 'assigned_to' with actual field name
hardwareGR.query();

var devices = [];
while (hardwareGR.next()) {
    devices.push(hardwareGR.name);  // Replace 'name' with actual field name
}

current.devices = devices.join(', ');

Thank you, please make helpful if you accept the solution.