
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2017 08:02 AM
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?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2017 08:57 AM
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');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2017 08:10 AM
On which table are you trying to build this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2017 08:14 AM
Incident table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2017 08:57 AM
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');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2017 08:21 AM
hi abhinay,
I tried the code you have. What do i need to change - i put in the exact group name and it's sysid both.. does not work...
Also is this correct -
sys_id IS ONE OF javascript: new GetCallerIncidents().callerGroup('your exact group name goes here');
I am using this as a script include but adding this code line above to the field style....where i say that if the user is a member of a group show an image...