adding or removing option in a list collector variable in a catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 03:49 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 06:17 AM
@Amit Dey1 Then try the below reference qualifier
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 06:27 AM
same not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 06:31 AM
@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.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 08:45 PM
it is showing error , as the visibility field is referencing to the same table where it is created
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2023 09:37 PM
@Amit Dey1 Got it. We need to create the script there.
Add the below advanced reference qualifier to second field
Create TestUtil script include which is used in reference qualifier as below
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.
ServiceNow Community Rising Star, Class of 2023