- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2024 11:52 AM
Hi,
There is a requirement that in Catalog item there is 2 field
1. Group name (reference field)
2. Group Members
So on selecting any Group Name, then in Group Members field all the available group members should auto populate.
**which field Type should be taken for Group member field??
Please help!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2024 01:01 PM
Hi @shubhi211 ,
You can achieve this through onChange Client script and script include,
Few things to note down
1.make Group member field as list collector,
2.create onchange of Group field.
3.Make script include Client callable
Client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var sysid = g_form.getValue('group');
var ga = new GlideAjax('getGroupMemeber');
ga.addParam('sysparm_name','getGroup');
ga.addParam('sysparm_id',sysid);
ga.getXML(getResponse);
}
function getResponse(response){
var ans = response.responseXML.documentElement.getAttribute('answer').toString();
alert(ans);
g_form.setValue('group_members',ans);
}
Script include:
var getGroupMemeber = Class.create();
getGroupMemeber.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroup: function() {
var sysID = this.getParameter('sysparm_id');
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', sysID);
var arr = [];
gr.query();
while (gr.next()) {
arr.push(gr.user.toString());
}
gs.info('line number 16 ' + arr);
return arr.toString();
},
type: 'getGroupMemeber'
});
Result:
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2024 01:07 PM
@shubhi211 , For Group Manager field you can use Auto populate feature,
Similarly you can configure for group Email
Result:
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 04:59 AM
Hi swathi,
In Alert I am getting the sys id of the user and in group members fields the value is not GETTING POPULATED
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 07:14 AM
@shubhi211 ,what is the type of field (Group member)? and did you reference the list table to sys_user ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 07:14 AM
@shubhi211 ,what is the type of field (Group member)? and did you reference the list table to sys_user ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 08:07 AM
Thank you soo much, I got the answer😌