- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2017 11:55 AM
Hi Folks,
I am new to service now and I have a requirement.
I have two dropdown fields in our catalog form. in first dropdown there are two values and values in 2nd dropdown field is coming from a custom table.
The actual requirement is to filter the 2nd dropdown based on first dropdown selection. In our custom table there is an entry of the first dropdown value in all record. So we can filter based on that. But I dont know the process to do that.
Please help me to do the same.
Regards,
Sonu
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2017 02:37 PM
Please refer below post which will help you to implement your requirement.
http://wiki.servicenow.com/index.php?title=Adding_Dependent_Variables#gsc.tab=0
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2017 02:37 PM
Please refer below post which will help you to implement your requirement.
http://wiki.servicenow.com/index.php?title=Adding_Dependent_Variables#gsc.tab=0
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2017 11:48 PM
Hi Sonu,
You should be writing an on change client script on the first drop down variable and the dependent values can be populated on the 2nd dropdown. If the values are stored on a different table, then you need to make a server call from your client script or if values are hard coded, you can just add these lines after modifying logic according to your requirement.
if(newValue == 'a'){
g_form.addOption('seond_variable_name', 'b', 'B');
g_form.addOption('seond_variable_name', 'c', 'C');
}
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2017 12:36 AM
Thanks Alikutty and Najoshi for you reply
@ Alikutty - I have the values stored at server side. I have also written an script include to filter the dropdown. But it is filtering only at the loading time. But I need to refresh the 2nd dropdown every time when I change my first dropdown. This is not happening. How to achive the functionality when I change the value in my first dropdown.
Regards,
Vikash

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2017 12:59 AM
you can call the script include on your 2nd field as advanced reference qualifier. Reference Qualifiers - ServiceNow Wiki
sample code, please modify per your need.
var GetListValue = Class.create();
GetListValue.prototype = {
initialize: function() {
},
getList : function()
{
var ids = [];
var gr = new GlideRecord('Your table name');
var sys_id = this.getParameter();
gr.addQuery('<sys_id variable>', sys_id);
gr.query();
while(gr.next())
{
ids.push(gr.sys_id.toString());
}
return 'sys_idIN' + ids;
},
type: 'GetListValue'
};
also, i think you can create a datal ookup between between these two fields.