- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 04:47 AM - edited 08-24-2023 05:03 AM
Good Morning,
Current Instance is Tokyo -
I have 2 Variables on a Service Catalog
Variable 1 is a Selectbox (Region) with Region I and Region II for Choices
Variable 2 is a Selectbox (Territories) with DC, MD, NC,SC, PA
so my question is .. is there away to hide DC and MD in (Territories) if (Region) is Region I and Hide NC, SC, and PA if Region 2 is selected.
This is what i attempted but it's not doing what is required
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 05:26 AM - edited 08-24-2023 05:27 AM
Hello @Walter Toney
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var reg = g_form.getValue('region');
if (reg == 'Region I') {
g_form.clearOptions('region');
g_form.removeOption('territories', 'DC');
g_form.removeOption('territories', 'MD');
}
if (reg == 'Region II') {
g_form.clearOptions('region');
g_form.removeOption('territories', 'NC');
g_form.removeOption('territories', 'SC');
g_form.removeOption('territories', 'PA');
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 05:26 AM - edited 08-24-2023 05:27 AM
Hello @Walter Toney
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var reg = g_form.getValue('region');
if (reg == 'Region I') {
g_form.clearOptions('region');
g_form.removeOption('territories', 'DC');
g_form.removeOption('territories', 'MD');
}
if (reg == 'Region II') {
g_form.clearOptions('region');
g_form.removeOption('territories', 'NC');
g_form.removeOption('territories', 'SC');
g_form.removeOption('territories', 'PA');
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 05:31 AM
Hello @Walter Toney ,
Select 'Variable Name' field value = 'region' in catalog client script
And try this script...
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if ( newValue == "Region I" ){
g_form.removeOption('territories', 'DC');
g_form.removeOption('territories', 'MD');
g_form.addOption('territories', 'NC', 'NC');
g_form.addOption('territories', 'SC', 'SC');
g_form.addOption('territories', 'PA', 'PA');
}
else if ( newValue == "Region II" ){
g_form.removeOption('territories', 'NC');
g_form.removeOption('territories', 'SC');
g_form.removeOption('territories', 'PA');
g_form.addOption('territories', 'DC', 'DC');
g_form.addOption('territories', 'MD', 'MD');
}
}
Help others to find a correct solution by marking the appropriate response as correct answer and helpful.