Lookup Select Box - how to change depending on another lookup select box
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2019 01:25 AM
Hi community,
I have trouble changing options of a lookup select box, and I couldn't find past articles which can help my situation.
Lookup Selection Box A: where users choose item name to order (there are a lot of items to be ordered packed in a service catalog... this may be a cause of this trouble...)
Lookup Selection Box B: where users choose item size, and displayed size option should depend on the option selected in A.
Both options are referenced from the same master table.
However, the query filter seems somehow only work within the table.
Such as, when I set to
type | is | for men
it worked.
However, when I set to
item name | is same as | <value of A>
it didn't.
btw, I first switched to the type to "Reference" instead of "Lookup~" and I set the Reference qualifier condition.
The condition seemed ok, but when I switched to "Lookup~", the reference qualifier said,
item name | is same as | item name (the same field of the same table)
Is there any way to rewrite this reference qualifier or create Client Script to work it just as I want?
I also failed to work with a client script... (see the image & script below, please)
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
g_form.clearOptions('u_item_size_women');
var choice = new GlideRecord('u_uniform_item_master');
choice.addQuery('u_item_name', newValue);
choice.query();
while(choice.next()){
g_form.addOption('u_item_name',choice.u_item_size);
}
}
Thank you!
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2019 01:56 AM
can you share the variable reference qualifier?
Something like this should work
reference qualifier
javascript: 'u_item_size_women='+current.variables.item_name_women;
Also, check if the ref_qual_elements is set that is available in Default Value -->
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2019 07:01 PM
Thank you Rad,
<field A> u_item_name_women
<field B> u_item_size_women
Both are in a Variable set "u_vset_women".
The column to query with field A is "u_item_name".
The column to get values is "u_item_size".
So I adjusted field names as below:
javascript: 'u_item_name.value='+current.variables.u_vset_women.u_item_name_women;
At least, the field B started to display all select options, however, including NOT the ones concerning field A's value.
I suspect ".value" part after "u_item_name" is incorrect...
Would you please help me a little more?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2019 11:15 PM
the below should work
javascript: 'u_item_name='+current.variables.u_item_name_women;
in the variable attributes, do add the ref_qual_elements
Do let us know if this works
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2019 11:40 PM
Thank you, rad,
however, no fruit yet...
earlier, the size field showed simply all the size options,
now somehow nothing except "--None--" is displayed.
Just to make sure, am I writing the correct variable attribute?:
ref_qual_elements=u_item_name_women
I am very grateful if you could help me a little more.
Cheers,
Lit