- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 05:12 AM
I have 3 fields in a record producer , user , role and group. all are reference fields . I want user to be selected as logged in user, groups which are available should be only user's group and roles which should be available are selected groups role
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 07:08 AM
Hi Uma,
You can call like this
javascript:new FillGroup ().getGroupRoles(current.variables.your_group_var)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 06:39 AM
Hi Asif,
I tried it and wrote below
var FillGroup = Class.create();
FillGroup.prototype = {
initialize: function() {
},
find_group:function()
{
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user',gs.getUserID());
gr.query();
while(gr.next())
{
return gr.group.toString();
}
},
type: 'FillGroup'
};
but it is not filtering the groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 06:48 AM
You need to return a query string of all the groups:
var FillGroup = Class.create();
FillGroup.prototype = {
initialize: function() {
},
find_group:function()
{
var groups = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user',gs.getUserID());
gr.query();
while(gr.next())
{
groups.push(gr.getValue('group');
}
return 'sys_idIN' + groups;
},
type: 'FillGroup'
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 06:55 AM
Hi Uma,
Your code currently returns only 1 group. Fist you need to collect all group_ids of that user and store them in a array.
and then you need to pass it like this
return 'sys_idIN'+ your group_ids.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 07:05 AM
Hi Asif,
Thanks, Now when i look for roles, I need to pass selected group name as parameter while calling the function in reference qualifier, could you please help me with syntax of that ?
Thanks!
Uma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2019 07:08 AM
Hi Uma,
You can call like this
javascript:new FillGroup ().getGroupRoles(current.variables.your_group_var)