Autopoulation for variable list collector.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2025 07:03 AM
Hi @everyone
I have a requirement where i need to auto populate all the groups from organization table to my catalog variable group.
I have a field in my table name as AD groups those should be auto populated in my catalog variable groups which is a list collector.
How can i do this?
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2025 07:20 AM
auto populate based on some filter?
you can use default value in that list collector and set your logic which sets the sysIds of those records
share some screenshots, list collector refers to which table
which other table are you referring here
what did you start with?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2025 07:28 AM
Hi @Ankur Bawiskar , my requirement we have AD groups field in our u_organization table which consists of all groups from sys_user_group table. we fill them manually when any new organization is required. Now we have a catalog form for requesting a change in those groups. So when Organization name is selected in the form these group variable should be auto populated from AD group field which is in u_organization table,
BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2025 07:44 AM
so you can use onChange catalog client script with GlideAjax and bring those groups
Something like this
Script Include: It should be client Callable
var GetOrgADGroups = Class.create();
GetOrgADGroups.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getADGroups: function() {
var orgSysId = this.getParameter('sysparm_org_sysid');
var result = [];
if (!orgSysId)
return '';
var orgGR = new GlideRecord('u_organization');
if (orgGR.get(orgSysId)) {
// Assuming u_ad_groups is a List field storing sys_ids of sys_user_group
var adGroups = orgGR.u_ad_groups + '';
if (adGroups) {
result = adGroups.split(',');
}
}
return result.join(',');
},
type: 'GetOrgADGroups'
});
onChange Catalog Client Script on the reference variable which Refers to u_organization table
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
// Optionally clear the group variable here
g_form.clearValue('groupVariableName');
return;
}
var ga = new GlideAjax('GetOrgADGroups');
ga.addParam('sysparm_name', 'getADGroups');
ga.addParam('sysparm_org_sysid', newValue);
ga.getXMLAnswer(function(response) {
var groupSysIds = response;
if (groupSysIds) {
// Set the list collector variable (replace 'groupVariableName' with your variable name)
g_form.setValue('groupVariableName', groupSysIds);
} else {
g_form.clearValue('groupVariableName');
}
});
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2025 08:25 AM
Hi @Ankur Bawiskar , do we need to give any sys_id in