- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-15-2019 06:24 AM
Hi All,
Unfortunately, catalog variables do not have a dependency like a field we have on the forms.
The dependent variables can be created in the service catalog in two ways:
A. Using Client Script: Onchange of Category field write following script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '')
{
g_form.clearOptions('subcategory');
g_form.addOption('subcategory', '', '-- None --');
return;
}
if(newValue =='Category 1')
{
g_form.clearOptions('subcategory');
g_form.addOption('subcategory', '', '-- None --');
g_form.addOption('subcategory','Subcategory11','Subcategory11');
g_form.addOption('subcategory','Subcategory12','Subcategory12');
g_form.addOption('subcategory','Subcategory13','Subcategory13');
}
else if(newValue =='Category 2')
{
g_form.clearOptions('subcategory');
//g_form.addOption('subcategory', '', '-- None --');
g_form.addOption('subcategory','Subcategory21','Subcategory21');
g_form.addOption('subcategory','Subcategory22','Subcategory22');
g_form.addOption('subcategory','Subcategory23','Subcategory23');
}
else if(newValue =='Category 3')
{
g_form.clearOptions('subcategory');
g_form.addOption('subcategory', '', '-- None --');
g_form.addOption('subcategory','Subcategory31','Subcategory31');
g_form.addOption('subcategory','Subcategory32','Subcategory32');
g_form.addOption('subcategory','Subcategory33','Subcategory33');
}
}
B. By Creating the table:
The client script cannot be used when we have a large number of categories and subcategories. So in such a case, we have to follow the 2nd way i.e create a table. Following are the steps you need to follow:
Now consider bank name as category and Bank choice as subcategory.
STEPS:
1. Create a custom table that contains the values of the category and subcategory. This will act as a dependency table.
2. Create Category - type of variable->Select box , and add all the required choices
3. Create Subcategory - type of variable->Lookup select box
4. Add Reference Qualifier and Variable attributes as shown in the above image.
Hit like if this post helps you.
Regards,
Snehal Madakatti
- 34,278 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
The Script works Perfect. Thank You
- « Previous
-
- 1
- 2
- Next »