- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 09:47 AM
Hi All,
i would like to get List of groups (type = request) of user from requested for to a reference type field.
can someone help me with Script include and advanced reference qualifier.
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 08:32 AM
I would say this is the right way to do it on this request!!
--------------Script Include------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 10:09 AM
Hi @Ram050670,
Script include script-
getUserRequestGroups: function(userId) {
var groups = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', userId);
gr.addQuery('group.type', 'request');
gr.query();
while (gr.next()) {
groups.push(gr.group.toString());
}
return groups;
},
Reference qualifier script in user group list field-
javascript: new GroupUtils().getUserRequestGroups(current.user.toString())
Please mark it as solution proposed and helpful if it works for you.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 10:27 AM
tried but not working, showing all groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 10:32 AM - edited 10-17-2023 12:07 PM
Hi @Ram050670
Script include script-
getUserRequestGroups: function(userId) {
var groups = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', userId);
gr.addQuery('group.type', 'request');
gr.query();
while (gr.next()) {
groups.push(gr.group.toString());
}
return 'sys_idIN'+groups;
},
Reference qualifier script in user group list field-
javascript: new GroupUtils().getUserRequestGroups(current.variables.name.toString())
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.👍
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 10:39 AM
i actually tried that too! req backend is name.