Show one choice in drop down based on selection of another drop down field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2025 03:31 PM
Hello Friends,
Need your help with this requirement
There are two drop down fields on the form:
1.Select Request Area (select_request_area ) with 13 choices
2. Request Type ( request_type) with 12 choices
got a requirement like this , if select area = claims or Group benefits or Commerical or small scale
then
Show only one option 'Verint Quality' for 'Request type' drop down
For all other request areas show all options under Request type ( i.e do nothing )
How to achieve this requirement?
Thanks for your time reading my post and responding to it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2025 05:08 PM
Hi Vahini,
Create on-change client script to show/hide drop-down values on the second question based on the first question values.
Below youtube video will give some idea on how to configure.
https://youtu.be/EOqL_YsOmE4?si=mTwr6h9kFXfUT-vh
Thanks,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2025 07:16 PM
you can do this
1) write onChange on 1st field
2) in that clear all the options using g_form.clearOptions('request_type')
3) then based on value of 1st field add 1 by 1 the options using g_form.addOption('request_type', 'choicevalue', 'choiceLabel');
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 12:52 PM
Used onchange client script to achieve it
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var req_area = g_form.getValue('select_request_area');
// alert(req_area);
g_form.clearOptions('request_type');
if (req_area == 'Claims Ops – P&C and GB' || req_area == 'Group Benefits (GB)' || req_area == 'Middle Large Commercial (MLC)' || req_area == 'Personal Lines Operations Only (PL)') {
g_form.clearOptions('request_type');
g_form.addOption('request_type', "", "--None--");
g_form.addOption('request_type', 'Verint Quality Form-Change/Add', 'Verint Quality Form-Change/Add');
} else {
g_form.clearOptions('request_type');
g_form.addOption('request_type', "", "--None--");
g_form.addOption('request_type', 'CCES/Employee Hierarchy', 'CCES/Employee Hierarchy');
g_form.addOption('request_type', 'Consultation', 'Consultation');
g_form.addOption('request_type', 'Enhancement', 'Enhancement');
g_form.addOption('request_type', 'Existing Report/Tool Change', 'Existing Report/Tool Change');
g_form.addOption('request_type', 'New One Time Data Request', 'New One Time Data Request');
g_form.addOption('request_type', 'New Ongoing Report/Metric or KPI', 'New Ongoing Report/Metric or KPI');
g_form.addOption('request_type', 'Report/Data Discrepancy – Research Needed', 'Report/Data Discrepancy – Research Needed');
g_form.addOption('request_type', 'Request for Access to Existing Report', 'Request for Access to Existing Report');
g_form.addOption('request_type', 'Request for Maintenance', 'Request for Maintenance');
g_form.addOption('request_type', 'Tableau Support', 'Tableau Support');
g_form.addOption('request_type', 'ThoughtSpot Support', 'ThoughtSpot Support');
}
}