adding or removing option in a list collector variable in a catalog item

Amit Dey1
Tera Contributor

Hi , for my requirement , I have to create 2 list collectors variable , both is referencing to a same table ,

if I select a value from the 1st list collector variable , some values will be shown and when not selecting the value , those values in 2nd list collector variable will not be shown , how can we achieve this 

21 REPLIES 21

@Amit Dey1 Then try the below reference qualifier

 

jaheerhattiwale_0-1673360228871.png

 

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

same not working

@Amit Dey1 It should work with reference qualifier only.

 

Make visibility field reference field and it should refer to the same table. And then try this reference qualifier.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

it is showing error , as the visibility field is referencing to the same table where it is created

@Amit Dey1 Got it. We need to create the script there.

Add the below advanced reference qualifier to second field

jaheerhattiwale_0-1673415350630.png

 

Create TestUtil script include which is used in reference qualifier as below

jaheerhattiwale_1-1673415385807.png

 

Script:

var TestUtil = Class.create();
TestUtil.prototype = {
initialize: function() {
},

getSysIds: function(firstField){
var secondFieldValues = [];
var tableGr = new GlideRecord("<YOUR TABLE NAME HERE>");
tableGr.addQuery("u_visibilityIN"+firstField.toString());
tableGr.query();

while(tableGr.next()){
if(secondFieldValues.indexOf(tableGr.sys_id.toString()) < 0){
secondFieldValues.push(tableGr.sys_id.toString());
}
}

return "sys_idIN"+secondFieldValues.toString();
},

type: 'TestUtil'
};

 

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023