
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2023 04:31 AM
I have a form with 3 reference fields, referring the same table.
Level 1, Level 2, and Level 3.
The referenced table is called Level and it is organized like:
Description, Level 1, Level 2.
When Level 1 is empty, I understand the record is Level 1.
When Level 1 is not empty, and Level 2 is empty, I understand the record is Level 2.
When Level 1 and Level 2 are not empty, I understand the record is Level 3.
Example:
Description | Level 1 | Level 2 |
1 | empty | empty |
2 | empty | empty |
1.1 | 1 | empty |
1.2 | 1 | empty |
1.1.1 | 1 | 1.1 |
2.1 | 2 | empty |
2.2 | 2 | empty |
1.1.2 | 1 | 1.1 |
2.2.1 | 2 | 2.2 |
In the form, I have something like this...
Category:
Level_1: (Reference of Level table)
Level_2: (Reference of Level table)
Level_3: (Reference of Level table)
What I want is:
When I select 1 as Level_1, in the field Level_2 appear only 1.1 and 1.2
When I select 1.1 as Level_1, in the field Level_3 appear only 1.1.1
For that I made Level_1 as dependent field of Level_2, and Level_2 as dependent field of Level_3.
The problem is that Level_3 is returning no values.
For Level_2 is working fine.
 
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2023 04:28 AM
I could solve this problem using reference qualifier in the reference field.
 

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2023 12:40 PM
Can you create an onChange Client on Level 2 variable something like below?
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.clearOptions(level_3_field');
var gp = new GlideRecord('custom_table_name');
gp.addQuery('variable_2_name_on_the_custom_table',newValue);
gp.query(function(gp) {
while(gp.next())
g_form.addOption('variable_level_3_on_the_form,gp.variable_3_name_on_the_custom_table,gp.variable_3_name_on_the_custom_table);
});
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2023 04:20 AM
Thanks Alp Utku.
I tried this approach, but did not work well.
When I save the record, it does not match the existent value in the record, so every time I load the form seems like the value is empty.
I tried an onLoad Client Script but also did not work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2023 04:28 AM
I could solve this problem using reference qualifier in the reference field.