We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Reference qualifier to show specific user group

nealp_
Tera Contributor

I have a field on the form "Executives" and I want to use reference qualifier to show a specific group 'exec_group'. I can reference the 'user' in the reference but how do I filter through to show just the user group with select few users?

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

You need advanced reference qualifier for this. Create a script include and put this script in there


function   GetExecutiveMembers(){


  var id=[];


  var gr= new GlideRecord('sys_user_grmember');


  gr.addQuery("group.name","your group name");


  gr.query();


  while(gr.next()){


  id.push(gr.getValue("user"));


  }


  return "sys_idIN"+id.join();


}


View solution in original post

10 REPLIES 10

Thanks for the reply Abhinay, but I was trying to stay away from doing a script include. Is there a way to get around without doing the script?


Thanks Abhinay,



I've got the script include built, how do I call that?


In the reference qualifier put this in there:



javascript: function_name();



find_real_file.png


zica
Giga Guru

PAtel,



If you would like to restrict the values that are queried to the members of a specific group of users by using an Advanced Reference Qualifier then First a GLOBAL Business Rule must be created:


function getSpecificGroupMembers(group_sys_id) {

    var answer = '';

    var group_members = new GlideRecord('sys_user_grmember');
    group_members.addQuery('group', group_sys_id);
    group_members.query();

    while (group_members.next()) {
          answer += ',' + group_members.user.sys_id;
    }

    return "sys_idIN" + answer;
}



Then, the "Reference qual:" Dictionary attribute must contain: javascript:getSpecificGroupMembers("<sys_id_of_the_desired_group>");


Abhinay Erra
Giga Sage

Did you get this working?