- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2021 07:58 AM
Hello, I posted something similar but but want to revisit -
I have a catalog item which has a dropdown and a list collector variable. Based on the selection in the dropdown variable, I want only the associated list collector values to be displayed.
So, variable 1 is the dropdown. If I select Testing and Monitoring Group B, I want only the associated values for that to show in the Role field (variable 2).
Here is the table setup that populates the list collector: you can see the 2 columns - GRC(s) is the "Module" column (meaning the values there match what are in the dropdown variable) and then the associated roles are in the next column.
I am currently trying to achieve this by using an on change client script: I found this solution on another community post - however this is not working. I am not sure what is going wrong. Any ideas?
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
var role= g_form.getValue('archer_GRC_module'); - This is the dropdown variable name
var collectorName = 'req_role_risk_assessment'; - This is the Role List Collector variable name
var filterString = 'archer_GRC_module'+role;
try{
var myListCollector = g_list.get(collectorName);
myListCollector.reset();
myListCollector.setQuery(filterString);
}
catch(e){
window[collectorName + 'g_filter'].reset();
window[collectorName + 'g_filter'].setQuery(filterString);
window[collectorName + 'acRequest'](null);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2021 06:29 AM
Hi,
are you using the correct field name to compare and correct variable name
Also why not to use advanced ref qualifier instead of setting the filter
Please use this
1) advanced ref qualifier on list collector
javascript: 'archer_GRC_module=' + current.variables.archer_GRC_module;
Also remember for the list collector variable you need to set this in the variable attributes for the ref qualifier to work fine
ref_qual_elements=archer_GRC_module
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2021 08:01 AM
You should just be able to use a reference qualifier for this on variable 2, something like:
current.grcs_field_name = current.variables.variable1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2021 08:11 AM
hi, I have added this reference qualifier to the list collector variable and that didn't do the trick.
javascript: current.u_grc_s= current.variables.archer_GRC_module
u_grc_s is the field name on the table that populates the list collector... any ideas?
Do I still need the client script also?
Thank you for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2021 08:12 AM
If your reference qualifier is correct you do not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2021 08:26 AM
Thanks. So based on the information I've provided, do you see anything wrong with this reference qualifier?
javascript: current.u_grc_s+current.variables.archer_GRC_module