show the groups only where the requested by is a part of
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2022 10:35 AM
Hey, i have a reference field which i have to populate with the groups for which the "requested by" is a part of "only". Help please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2022 09:56 AM
@Gunjan Kiratkar hey in the variable the group i have to refer will be sys group so the group from the script include will vary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2022 10:01 AM
Use below code
var getAjax = Class.create();
getAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroups: function(getReq) {
var groupArr = [];
var uID = getReq;
var grmember = new GlideRecord('sys_user_grmember');
grmember.addQuery('user', uID);
grmember.addQuery('group.active', true);
grmember.query();
while (grmember.next()) {
groupArr.push(grmember.group.toString());
}
return 'sys_idIN' + groupArr;
},
type: 'getAjax'
});
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2022 04:33 AM
hey im still not getting it @Gunjan Kiratkar