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

manish123
Giga Guru

I don't think that none of you has implemented this feature for your client or organization. Any help must be appreciated.


how are you calling this from your reference qualifier?



is it like javascript:backfillAssignmentgroup();




Also, you need to make sure that the name of the script include is same as that of the function.


Thanks for your response, Probir.


Yes, it is the same.


Is there any way to debug?


ProbirDas
Tera Expert

This is weird. I faced this issue once where the script include itself was not being called. I just re-opened/reloaded it and it worked fine for me. This is a strange suggestion. But you can try it