'glide_list' field because users want to select numerous values.

jsjsnaN
Tera Contributor

Hi,

 


I added choices to a 'glide_list' field because users want to select numerous values. However, I cannot add or remove field options based on other field values.

 

 

 

Any suggestions are welcome.

2 REPLIES 2

Arun_Manoj
Mega Sage

Hi @jsjsnaN ,

 

 

To dynamically filter the selectable values based on another field, do this:

🛠 Option 1: Reference Qualifier (Dynamic)

  1. Ensure your glide_list is a reference to a table (e.g., User or Group).

  2. Set a reference qualifier to dynamically filter based on another field:

    • Use a dynamic reference qualifier or a scripted one.

    • Example (in field dictionary → advanced view → Reference qualifier):

    javascript
     
    javascript:answer = current.related_field == 'xyz' ? 'active=true' : 'department=IT';

🛠 Option 2: Client Script (Form-specific logic)

 

javascript
 
function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; } // Set reference qualifier dynamically g_form.setReferenceQual('your_glide_list_field', 'active=true^department=' + newValue); }
  • Trigger: onChange of the field that drives the filter logic

  • Target field: your glide_list


⚠️ Important Notes:

  • If you're trying to allow multiple static values, glide_list may not be the best field type — consider using:

    • A multi-choice field with a choice list

    • A multi-row variable set (if you're in a catalog item context)

Omender Singh
Tera Guru

 

1. Use Reference Qualifiers

If your glide_list is referencing another table (like User, Group, etc.), set a Reference Qualifier to filter options based on another field.

 

How:

  • Go to the field in the dictionary (sys_dictionary).

  • Set a Dynamic Reference Qualifier or write a script-based qualifier.

Example script qualifier:

answer = "location=" + current.location;

So if you have a Location field, this filters glide_list items to only those matching the same location.

 

2. Use g_form.setValue() and g_form.setReadOnly() Client Scripts Carefully

Sometimes users try to pre-filter the values on the client side. While g_form.getValue() works fine, note:

  • g_form.setOptions() doesn’t work on glide_list.

  • Instead, pre-fill the list using g_form.setValue() if you already know valid values.

I prefer the first one though.