Dynamic Subcategory Dropdown Population in ServiceNow Workspace Based on Service Offering
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In ServiceNow Workspace (SOW), I want to populate the Subcategory field dynamically based on selected Service Offering using Script Include.
The Script Include returns a list of allowed subcategories.
My issue is:
- g_form.addOption() / removeOption() is not supported in Workspace
- I am not able to filter dropdown options
What is the correct or recommended way to dynamically populate or filter dropdown values in Workspace?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Naveen20,
We have a dependency on two fields: Category and Service Offering.
In the Category field, we have two values, and for each value there is a separate table where the Subcategory choice field and the Service Offering reference field are mapped. That is the issue here.
For example, one Service Offering can have 5 mapped choices (5 records).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Supported pattern for a many‑to‑many mapping driven by a custom table is to convert Subcategory from a choice field to a reference field pointing at your mapping table, then filter it with an advanced (dynamic) reference qualifier that calls your Script Include. Reference qualifiers are evaluated server‑side and work consistently in SOW, classic UI, and Portal.
Steps
Consolidate the two category-specific mapping tables into one (or a single view) with columns: category, service_offering, and subcategory (label/value). Two tables will force branching logic everywhere.
Change the Subcategory dictionary entry to type reference → that mapping table.
On the dictionary entry, set Reference qual = Advanced and use:
javascript: new SubcategoryFilter().getQuery(current.category, current.service_offering)
Script Include (client‑callable not required for ref qual):
var SubcategoryFilter = Class.create();
SubcategoryFilter.prototype = {
initialize: function() {},
getQuery: function(category, serviceOffering) {
return 'category=' + category + '^service_offering=' + serviceOffering;
},
type: 'SubcategoryFilter'
};
Set the form so Subcategory’s value clears when Category or Service Offering changes (UI policy or onChange g_form.setValue('subcategory','')).
If converting the field type isn’t acceptable, the only remaining supported route in Workspace is a Decision Table or server‑side validation Business Rule — there is no reliable client API to mutate choice options in Now Experience.