Filtering Assignment group based on Logged user

manish123
Giga Guru

Hi All,

In Incident page, if logged in user belong to Service Desk group then they could not able to see Admin group in "Assignment group" reference field. However, for others it will be accessible and visible. As per my knowledge, i think this could be achievable through defining the script include and referred it under advance qualifier.I have added log message too. In Admin group level, i have defined its type as Restricted and passing its sys_id in Query. However, It's hiding for all user and i couldn't able to see any message which should have printed on log file. Therefore, i think it's not executed at all. from where & how do i verify the same?

function backfillAssignmentgroup()

{

  try

  {

  gs.log(" hello");

  var grps='';

  var usr = gs.getUser().isMemberOf('Service Desk');

  if (usr == true)

  {

  var grp = new GlideRecord('sys_user_group');

  grp.addQuery('active',true);

  grp.addQuery('u_isparent',false);

  grp.addQuery('type','DOES NOT CONTAIN','123454a2370c82007b1e4a7a43990eec'); //Admin

  grp.query();

  while(grp.next())

  {

  grps+=(','+grp.sys_id);

  gs.log(' Name of Assignment group'+ grps);

  }

  return 'sys_idIN'+grps;

  }

  else

  {

  return;

  }

}

catch(err)

{

  gs.log('BackfillAssignment Issue' + err.message);

}

}

Any help would be much appreciated.

13 REPLIES 13

OK. Thanks.


Gurpreet07
Mega Sage

What i understand is you need to populate assignment group on based of logged in user but what you are doing is for some other purpose i.e. fill assignment group on basis of some other field value.


Proceed in following way .



1. create a client callable script include (getAssignmentGroup) having following type of code


function getAssignmentGroup()


{


  var query='';


  var usr = gs.getUser().isMemberOf('Service Desk');


  if (usr == true)


  {


        query = 'typeNOT LIKE123454a2370c82007b1e4a7a43990eec' ; //Admin


  }


return query() ;


}



2. configure dictionary for assignment group field .


3. Change 'Use reference qualifier' to advanced and then type following in reference qual


javascript:getAssignmentGroup()


Thanks, Gurpreet. Yes, you're right. I want to populate assignment group based on logged in user. I'll give a try to your suggested solution and come back with results.


Hi GN,



Is it working fine. In last instruction its return query .Let me know if you are facing any issues


Thanks, Gurpreet. Will let you know.