Catalog Client Script Issue

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2025 05:22 PM - edited 06-16-2025 05:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2025 10:42 PM
Hi @Chris Doernbra1,
When calling a client-callable Script Include, you don’t need to pass or define an argument-based function. In your code, you're doing exactly that, which is why you're not receiving the group sys_id and its corresponding members in the result variable. To fix this, you can add the following line to your code:
var groupSysId = this.getParameter('sysparm_groupSysId');
Also, please remove the argument in your function and try it again.
Please mark my solution as helpful and accepted for future reference.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2025 10:48 PM
Hi @Chris Doernbra1 ,
Please change logic in Script include
var GetGroupMembers = Class.create();
GetGroupMembers.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getMembers: function() {
var groupSysId = this.getParameter('sysparm_groupSysId');
gs.info('XX: START - Group ID: ' + groupSysId);
var userSysIds = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', groupSysId);
gr.query();
while (gr.next()) {
var userId = gr.getValue('user'); // Correctly retrieve sys_id
gs.info('XX: Found User Sys ID - ' + userId);
userSysIds.push(userId);
}
var result = userSysIds.length ? userSysIds.join(',') : "No Members Found";
gs.info('XX: Final User List - ' + result);
return result;
},
isPublic: function() {
return true; // Allows public access
},
});
If this information proves useful, kindly mark it as helpful or accepted solution.
Thanks,
BK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2025 10:50 PM
you are not accepting the parameter you are passing from GlideAjax
update script as suggested by other members and share the status
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