Selected values from list collector appearing twice on catalogue item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 07:50 AM
I've got a form that uses a list collector on the below field:
When I go onto my catalogue item, I'm not expecting the option of 'Acquirer' to appear. However, when I go into my catalogue item to the related question, the Acquirer option is re-appearing in the dropdown menu:
I'm using the following Script Include to collect the value of the field in my application:
var LBGPrePopulateCatItem = Class.create();
LBGPrePopulateCatItem.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
biarecord: function() {
var obj = {};
var sysid = this.getParameter('sysparm_id');
var bia_rec = new GlideRecord('u_bia_response');
bia_rec.get('u_business_application', sysid);
obj.pci_dss_capacities = bia_rec.getDisplayValue('u_pci_dss_capacities');
return JSON.stringify(obj);
},
type: 'LBGPrePopulateCatItem'
});
I'm using the following Client Script to populate the catalogue item based on the selected application:
function onChange(control, oldValue, newValue, isLoading) {
//if (isLoading) return;
var setValNulls = function(field, input) {
if (input == null || input == "null" || input == "") {
g_form.clearValue(field);
} else {
g_form.setValue(field, input);
}
};
if (newValue != '' || newValue != null) {
if (newValue == "true") {
var bus_app = g_form.getValue('business_application');
var ga = new GlideAjax('LBGPrePopulateCatItem');
ga.addParam('sysparm_name', 'biarecord');
ga.addParam('sysparm_id', bus_app);
ga.getXML(function(response) {
var ans = response.responseXML.documentElement.getAttribute("answer");
if (ans) {
var bia = JSON.parse(ans);
// alert(bia.type_of_hc_data);
setValNulls('is_the_application_in_scope_of_pci_dss', bia.in_scope_of_pci_dss);
}
});
}
}
g_form.setDisplay('drafted', false);
}
I was just wondering if anyone has seen this before and what can be done to stop it from reoccurring.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 07:57 AM
why do you feel it should not appear?
Are you applying any reference qualifier in it?
onChange is running on which variable and what does that script include return?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 05:16 AM
Hi @Ankur Bawiskar In the screenshot example, Acquirer in the list shouldn't appear again if it's already been selected.
It's a list collector and I'm applying the following reference qualifier:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 05:20 AM
are you sure there are no duplicates in choice table?
you are setting the value using onChange
Are you sure there you are receiving correct number of values?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 06:15 AM
In flow designer, I'm using the following to get the values of the selected choices since List Collector is not valid in flow designer:
Could this be causing the issue?
If I try and select the variable manually, it's not allowed: