- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 06:33 AM
I have a script that has worked in the past for filtering a list collector based on the lookup select box selection, but not sure how to modify the script to filter a 'lookup select box' based on another lookup select box:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var filterString = "";
//Look for Application
var pf = g_form.getValue('application');
//Concat to filter u_platform=cba
if(pf != "") filterString += "^u_platform="+pf;
else if(pf != "") filterString = "u_platform="+pf ;
var roleCat= 'role_cat';
window[roleCat + 'g_filter'].reset();
window[roleCat + 'g_filter'].setQuery(filterString);
window[roleCat + 'acRequest'](null);
}
When user selects the 'application', the second lookup select box should only show those values associated with that application:
First field in the form: application (column name in the table is 'u_platform')
Second field on the form I need to filter: role_cat
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 07:43 AM
Hi,
To bind first variable use
For dependent filed use Reference qual
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2018 10:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2018 10:11 AM
It was already on the form but still did not display. I had to make the field a reference field then change it to a lookup as noted in this post: https://community.servicenow.com/community?id=community_question&sys_id=7d93c765dbd8dbc01dcaf3231f961994
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 12:23 AM
Thank you for detailed explanation. It really helped me a lot.