- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 06:10 AM
I am looking to make an advanced reference qualifier for a user reference field. I want it so when a this field is selected, only certain members from a group show up. What would the script method be?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 06:26 AM
Hi Josh,
You need to write your own custom script include. I have just created one. Below is the code.
--
var GroupUtil = Class.create();
GroupUtil.prototype = {
initialize: function() {
},
memberofGroup: function(){
var users=[];
var grp = new GlideRecord('sys_user_grmember');
grp.addQuery('group','1c590685c0a8018b2a473a7159ff5d9a');
grp.query();
while(grp.next()) {
users.push(grp.getValue('user'));
}
gs.addInfoMessage('sysIDIN'+users.join(','));
return 'sys_idIN'+users.join(',');
},
type: 'GroupUtil'
};
---
Here is the screen
You need to call this from ref qualifier.
javascript:new GroupUtil().memberofGroup()
hope this helps
Cheers
Srini
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 07:23 AM
Hi Michael,
Guess what, I have also searched for such oob utility when i saw this question. Could not find one, so just wrote it.
Cheers
Srini
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 07:00 AM
Thanks, Srini! This worked!