Dependent values getting erased if we are using g_form.removeOption for onchange client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 06:26 AM
I have two variables, request type and subrequest type. values of sub request type are dependent on request type. Now I have added all the question choices for sub request type and using g_form.removeOption to hide the values based on selected requested type value. But for the first selection of request type i am getting the desired sub request type values, but for subsequent slections i am not able to see any values in sub request type.
Any one can help please

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 06:34 AM
@SamiranD Ideally, you shouldn't be achieving via a client script. It should ideally be done via dependent value field in the choice list.
Once the dependent values on the subrequest type are defined then the choices would get updated depending up on the request type.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 06:36 AM
I am talking about variables in a catalog item not a field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 06:42 AM
@SamiranD Thanks for the clarification, for catalog items, you should instead try to use a Look up select box and use a reference qualifier to filter the data. Here is a post covering the same topic https://www.servicenow.com/community/developer-articles/solved-dependent-variable-on-catalog-item-us...
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2025 07:25 AM
Can you share the script you are using to populate the subtype? I assume it's a catalog client script designed to run on change of type. If we see your script, we can possibly find where the issue is.