How to manage choices in glide_list type field

SunilKumar_P
Giga Sage

Hi,

 

I have created a field of type 'glide_list' as users want to select multiple values in it and have added choices to this field. However, I am unable to add or remove options on this field based on other field value.

 

Any suggestions would be greatly appreciated.

 

Regards,

Sunil

1 ACCEPTED SOLUTION

Hey Sunil,

 

I did some testing on my own and I was able to get this to work (in contrast to my previous reply). This is a little experimental (and guesswork), so your millage may very. Try this in your onChange client script:

 

g_form.removeOption('choice.incident.<variable_name>', '<choice_value>');

 

Replace <variable_name> with the Column Name of your variable, and <choice_value> with your choice Value. If you are on a different table, try replacing incident with your table name (or inspect the HTML to see what is listed for that element).

 

Basically I inspected the HTML element for the Glide List field and saw that choice.incident was a prefix of the field name. Running g_form.RemoveOption() in my browser console successfully removed the option. See attached for examples.

 

Remember that you will need to use g_form.addOption() to re-add any options you removed client-side if needed.

Hope this helps! Let me know if you need an example of a client script.

View solution in original post

11 REPLIES 11

Hi @Zach N, thanks for the wonderful solution at normal record form. Do you know any solution the same for Service Portal ? It looks like it doesn't work the same like that

Stephen F
Tera Contributor

Hi Sunil,

 

You can use the Dependent field method. (see Attached Picture)

 

In the Dictionary Entry for the field you want to filter the choices:

  1. Make sure you are in "Advanced" View 
  2. List Field type is selected
  3. Label and Name of the Field you want filter the choices
  4. Go to "Dependent Field" tab
  5. Check the "Use Dependent Field" Check box
  6. Select the field you want to use as your filter value.
  7. Save Form
  8. Go to Choices Tab 
  9. In the Dependent Value Column, put the Value from the other field that you want each choice to filtered by. 

Notes:

  • No Reference Qualifier is needed with this method.
  • I have yet to make it work with another glide list field, but I am still trying with Ref Qual and script includes or Client Scripts.

I hope this helps!!

 

Stephen