Advanced reference qualifer

josh_brostoff
Giga Contributor

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?

1 ACCEPTED SOLUTION

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



Screen Shot 2016-02-04 at 7.54.05 PM.png




You need to call this from ref qualifier.



javascript:new GroupUtil().memberofGroup()




hope this helps



Cheers


Srini


View solution in original post

6 REPLIES 6

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


Thanks, Srini! This worked!