Selected values from list collector appearing twice on catalogue item

matthew_hughes
Kilo Sage

I've got a form that uses a list collector on the below field:

matthew_hughes_0-1740670897898.png

 

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:

matthew_hughes_1-1740670984653.png

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. 

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@matthew_hughes 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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:

matthew_hughes_0-1741007810817.png

 

@matthew_hughes 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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:

matthew_hughes_0-1741011228829.png

 

Could this be causing the issue?

 

If I try and select the variable manually, it's not allowed:

matthew_hughes_1-1741011293142.png