How to make A variable dependent on another variable in service catalog.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 09:30 PM
How to make the following variable dependent.
When I selected Desktop then canon dt 101,canon dt 102 should be displayed ,
When i selected Floortop then canon ft 101, canon ft 102 should be displayed.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 09:43 PM
Hi Sharath,
Other approach is to create two variables with same name as" Printer Model" but with a different backend name and use UI policies to show and hide the variables as required.
For example, create printermodel1,printermodel2(With same name as "Printer Model".printermodel1 contains canon dt 101,canon dt 102 and printermodel2 contains canon ft 101, canon ft 102.
in ui policy condition mention the condition as printer type as desktop and in ui policy action make printermodel1 visible as "true".
Same done can followed for the second one
Mark my answer as correct if this helps you in any way
Regards,
Sravani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 05:37 AM
Hi,
You need to write an On Change Catalog Client Script here on the Variable "Printer Type" and use the code as below:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue == 'Desktop'){ // Replace "Desktop" with the backend choice value of Desktop here
g_form.clearOptions('Printer Model Variable name Here');
g_form.addOption('Printer Model Variable Name', 'Chocie 1 Value', 'Chocie 1 Label');
g_form.addOption('Printer Model Variable Name', 'Chocie 2 Value', 'Chocie 2 Label');
}else if(newValue == 'Floor Top'){ // Replace "floor Top" with the backend choice value of Desktop here
g_form.clearOptions('Printer Model Variable name Here');
g_form.addOption('Printer Model Variable Name', 'Chocie 3 Value', 'Chocie 3 Label');
g_form.addOption('Printer Model Variable Name', 'Chocie 4 Value', 'Chocie 4 Label');
}
//Type appropriate comment here, and begin script below
}
See screenshot below just replace the variables correctly and you should be good here.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke