- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 05:16 AM
Hi,
I have 2 drop downs in a catalog item I added all the possible values to the drop down ,
Now if I select option A in the First drop down I have to get the options X,Y,Z in the second drop down
if I select option B in first dropdown I have to get options R,S,T
I have used a catalog client script and
i am trying like this
var val = g_form.getValue('DropDown1 fieldName');
if(val == 'dropdown option value')
{
g_form.setValue('dropdown2fieldname','dropdown2optionvalue')
}
any wrong in that
how can i achieve this
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 05:24 AM
Hi
There are 2 ways.
1. you can configure option2 to be dependent on option 1. In this case the values of dropdowns should come from database.
2. If the values of dropdowns are static, then write onChange client script on option 1 and then add code like below
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue == "A") {
g_form.clearValues("option2");//put actual field name
g_form.addOption("option2","X","X");
g_form.addOption("option2","Y","Y");
g_form.addOption("option2","Z","Z");
}
}
Mark the comment as a correct answer and helpful if this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 12:44 AM
Hello Gowtham,
I have already provided you the code to achieve this functionality. Could you check and mark the appropriate comment as a correct answer.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2020 11:05 PM
Hello Gowtham,
Do you have any update on this? If the issue is resolved, kindly mark the comment as a correct answer so that the question is moved to the solved list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2022 05:49 AM
Hi @asifnoor I think we should use clearOptions instead of clearValues. With clearValues it did'nt work for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 12:15 AM
Hii @asifnoor
My question is that suppose:-
Scenario
If option A in the First drop down I have to get the options X,Y,Z in the second drop down
and if I select option B in first dropdown I have to get options R,S,T.
What is happening now:-
Step 1)I have selected option A and then Y in second drop down.
Step 2)Again I change to option B and then select S in second drop down.
Step 3)After submitting the case. we are getting additional value Y in the case details.
Correct---Only S should come
Incorrect---both S & Y are coming.
Please guide me.
Thanks & Regards
Utsav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 02:42 AM
What if values of dropdowns should come from database how should manage???