Populate values based on selection of options in list collector field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 01:41 PM
Hi,
I have a requirement, in catalog form there are 3 fields namely Select site name, Select Print groups and Printers included in group (FYI select print groups is dependent on select site name field) If any value is selected in select Print groups field, then printers' details need to populate in printers included in group field.
Select Print groups field is a list collector so multiple options can be selected...For example if i select "print group - tampa" in Select Print groups field then TAM-DV, TAM- SAT, Barcode these values need to be populate in Printers included in group field....likewiswe if i select more than 1 value in list collector field then respective printers details need to be populate in the field
Example
in this case 2 values selected so AM-DV, TAM- SAT, Barcode and zebra tear, zebra 00 zebra 10 these values need to be populate in printers included in group field
There are multiple options present in select print groups so based on selecting each option a set of printer details need to populate in printers field....I have list of printer details related to each group in excel.
How can we achieve this.....please help me with entire onchange script.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 03:00 AM
Hi @Harish KM ,
Thanks for the help it worked....but in u_kallik_site_codes_and_access_groups table when i start adding new printer values then multiple values are getting displayed here
here only single value needs to be display....how can we do that
in this field reference qualifier is added to display so

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 03:03 AM - edited 10-25-2023 03:03 AM
Hi @suuriya How come duplicate values occur. Do you have duplicate values in your table for different printers? If yes then you need to eliminate duplicate values
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 03:12 AM
These values are getting because whenever im creating new record in kallik table...here you can see there are 3 printer for PrintGroup- Tampa so in portal 3 PrintGroup- Tampa is getting displayed so i change this to
this
now only one print group tampa display but the problem is if i select that print group tampa then all 3 printers need to populate but as of now only one value gets populate....i think we are take just one record in script how we can change that.
This happen in this case also only one value populates

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 07:47 PM - edited 10-25-2023 07:49 PM
Hi @suuriya The below script should do it. Modify the script include like below
getApplication: function() {
var CI = [];
var answer = [];
var sysId = this.getParameter('sysparm_sys_id');
gs.info("har" + sysId);
var almAssetGr = new GlideRecord("u_kallik_sites_codes_and_access_groups");
almAssetGr.addQuery('sys_id', "IN", sysId);
almAssetGr.query();
while (almAssetGr.next()) {
CI.push(almAssetGr.getValue('u_printer'));
}
var gr = new GlideRecord("u_kallik_sites_codes_and_access_groups");
gr.addQuery('u_printer', "IN", CI.toString());
gr.query();
while (gr.next()) {
answer.push(gr.getValue('u_printer'));
}
gs.info("hari" + answer.join(","));
return answer.join();
},
Harish