Add Custom options to Lookup Select box Variable after filtering some options using Reference Qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2022 09:27 PM
Hi
I have two lookup select box variables (A & B) in my variable set. Variable A has some options(x,y) and when I select any value from Variable A it should populate the respective values in Variable B(there are some mapping values in the tables as shown below) after mapping the options from the table it should also append some extra options to Variable B.
For Variable B, I am using reference qualifier and getting the respective values when I select any value from Variable A but am unable to add the extra options to Variable B.
For example:
Mapping Table:
Child | Parent |
a | x |
b | x |
c | x |
1 | y |
2 | y |
3 | y |
Variable A has options (x,y).
When I choose x from Variable A, then Variable B should populate with values(a,b,c) and also I want to add some extra values(d,e). so overall VariableB should contain(a,b,c,d,e). is this possible?
Below is what I am done and what I achieved till now.
I added the below Reference Qualifier in Variable B and I am able to get the respective options.
javascript:
'Parent=' + current.variables.variableA;
Then, I have created the client script for the Variable A with onchange Type. This code adds the options to VariableB. but it's not working.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue == 'x'){
g_form.addOption('variableB','d','d');
g_form.addOption('variableB','e','e');
}
}
When I remove the above Reference Qualifier then onChange Code is working and its adding the options(d,e) but not options(a,b,c).
Please suggest to me any other alternative way or solution to this.
- Labels:
-
Service Catalog