How to populate List Collector field based on Select box field in Catalog Item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi All,
In one catalog item, I have two fields:
Role Category → this is a Select box field
Sub Category → this should be a list collector where user can select multiple roles. User wants this to be list collector as they want to select multiple roles
We have more than 200 sub values, so hardcoding in client script is not possible.
My requirement is:
When user selects a Main Category, only related Sub Category values should show in the list collector.
Main is single select, Sub is multi select.
What is the simple and best way to do this?
Can we achieve this using a Reference Qualifier and a mapping table?
Or is there a simpler way without too much client-side scripting?
Any suggestions or examples would be very helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @Mahalakshmi Rav,
Yes, you can achieve this cleanly without hardcoding using a mapping table + reference qualifier:
1. Create a mapping table u_role_category_map
u_category → Reference to Role Category
u_role → Reference to sys_user_role
2. Script Include (client callable):
var RoleMapAjax = Class.create();
RoleMapAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isPublic: function() { return true; },
getRolesForCategory: function() {
var cat = this.getParameter('sysparm_category');
var ids = [];
var gr = new GlideRecord('u_role_category_map');
gr.addQuery('u_category', cat);
gr.query();
while (gr.next()) ids.push(gr.u_role.toString());
return ids.join(',');
},
type: 'RoleMapAjax'
});
3. Catalog Client Script:
function getSubRoles() {
var cat = g_form.getValue('role_category');
if (!cat) return '';
var ga = new GlideAjax('RoleMapAjax');
ga.addParam('sysparm_name','getRolesForCategory');
ga.addParam('sysparm_category',cat);
ga.getXMLWait();
var answer = ga.getAnswer();
return answer ? 'sys_idIN' + answer : '';
}
4. Configure List Collector variable
Reference = sys_user_role
Reference qualifier = javascript:getSubRoles()
Result: When user selects a Role Category, the Sub Category list collector will only show the mapped roles.
Thanks & regards,
Siddhesh Jadhav
ServiceNow Community Rising ⭐ Star 2025
Please mark this answer helpful and accepted if it resolved your query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
I would not suggest creating a table for this use case, instead use Decision table feature.
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago - last edited 4 hours ago
What is the dependency of subcategory and role category?
Do you have that dependencies in a excel file or do you have some relation between them?
You can consider Decision Tables concept here to return the categories as output if role is matched.
Call the decision table from the script include and use reference qualifier to send the role category to that SI.
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @Mahalakshmi Rav ,
Yes, you can achieve this using a mapping table and a reference qualifier. Create a table that maps Role Category → Sub Category. Configure the Sub Category list collector with an Advanced reference qualifier that filters values from this mapping table based on the selected Role Category. Add a small onChange client script on Role Category to refresh the Sub Category list collector. This avoids hardcoding, keeps it scalable, and requires minimal scripting.
If you find my answer useful, accept it as solution and mark it helpful.