- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 02:38 AM
Hi,
I want to display all incidents that are created by my group members.
for eg: group A has 10members , so what all incidents are created by these 10members i need to see them
How can i achieve this?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 01:24 AM
Hi @soumya17 ,
created script and call it on the sysid field on the module.
1. Script Include:
var getMyGroupIncidents = Class.create();
getMyGroupIncidents.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getIncidnets: function() {
var users = [];
var groups = [];
var incidents = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', gs.getUserID()); //get logged in user sysid
gr.query();
while (gr.next()) {
groups.push(gr.group + '');
}
var grMem = new GlideRecord('sys_user_grmember');
grMem.addQuery('group', 'IN', groups); //add group sysid
grMem.query();
while (grMem.next()) {
users.push(grMem.user + '');
}
var inc = new GlideRecord('incident');
inc.addQuery('caller_id', 'IN', users);
inc.query();
while (inc.next()) {
incidents.push(inc.sys_id + '');
}
return incidents;
},
type: 'getMyGroupIncidents'
});
Screenshot:
2. Create a module and call above script include on it.
javascript:new getMyGroupIncidents().getIncidnets()
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 02:42 AM
Hi @soumya17 ,
Please look into this community post from 2019 which might help you towards a resolution, as it is the same requirement as yours: https://www.servicenow.com/community/developer-forum/all-incidents-created-by-group-members/m-p/1976...
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 02:50 AM
Please take a look in this POST
To find list of incident opened by people in the group you need to do this
Use the below code:
Created a Script Include
Name = groupMember
Client Callable = true
Script
var groupMember = Class.create();
groupMember.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getMember: function(grmember){
var mbrs = "";
var gr = new GlideRecord("sys_user_group");
gr.get("name",grmember);
var grmember = new GlideRecord('sys_user_grmember');
grmember.addQuery('group', gr.sys_id);
grmember.query();
while (grmember.next()) {
mbrs += grmember.user.user_name.toString();
if(grmember.hasNext())
mbrs += ",";
}
return mbrs;
},
type: 'groupMember'
});
In your Incident List
Created By is one of javascript:new groupMember().getMember("Service Desk");
Instead of Service Desk, you can give the group name of your choice and it will pull all the members of that group. and when you run the condition it will show you the list of incidents opened by people in the group(in this case it will show all incident created by group member of service desk)
Please Accept the solution, if it has answered your query!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 03:02 AM
For one group ok , but different caller will have different groups assigned na how can we check that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 03:20 AM
Hi @soumya17 ,
are you looking for the incidents which are created by logged in and user part of his groups?
ServiceNow Community MVP 2024.
Thanks,
Pavankumar