Condition Builder Caller is Member of Group

Katie A
Mega Guru

Hello, I am writing a report and I would like to use the condition builder to check if the Caller is a member of a certain group.

Table: Incident

Condition: Caller - Is Member Of - Groupname

I know that I probably need to build javascript class to call within the condition. How can I build this?

1 ACCEPTED SOLUTION

You will need to create a new client callable script include



Script include:


Name:GetCallerIncidents


clitn callable: true


var GetCallerIncidents = Class.create();


GetCallerIncidents.prototype = Object.extendsObject(AbstractAjaxProcessor, {


  callerGroup: function(group){


  var mem=[];


  var id=[];


  var grmem= new GlideRecord('sys_user_grmember');


  grmem.addQuery('group.name',group);


  grmem.query();


  while(grmem.next()){


  mem.push(grmem.getValue('user'));


  }


  var gr= new GlideRecord("incident");


  gr.addQuery('caller_id','IN',mem.join());


  gr.addActiveQuery();


  gr.query();


  while(gr.next()){


  id.push(gr.getValue('sys_id'));


  }


  return id.join();


  },


  type: 'GetCallerIncidents'


});




Now in your report use this



sys_id IS ONE OF   javascript: new GetCallerIncidents().callerGroup('your exact group name goes here');


View solution in original post

6 REPLIES 6

make sure client callable is checked also if you are adding to a field then just use javascript: new GetCallerIncidents().callerGroup('your exact group name goes here');


amiri1
Kilo Explorer

I tried that but did not work, with the group name and the sysid of the group too.



So, i am doing this on the list, in the "field style".


What i need to do is to see that the value for the field opened_by matches with a group that he is in.. if he is, then put an image or some background color....