Creating a report: Group members without task assignment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hello,
Sorry if my question is not in the right place.
For processing our requests, we assign tasks to a group, as well as to a member of that group (which I believe is the standard procedure).
I am looking to create a report that lists the members of this group who have never had any tasks assigned to them (and therefore never closed any).
I tried looking into sys_user_grmember and sc_task, but apart from requests closed by users, I haven't been able to find the opposite.
Would you have a solution, please?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @MARCHI Frederic,
To generate a report of group members who have never been assigned or closed any tasks, implement the following solution:
- Create a Script Include named "GetNeverAssignedUsers" with Glide AJAX enabled and Sandbox enabled. Use the following script:
function GetNeverAssignedUsers(group) {
var usersNeverAssigned = "";
var grMembers = new GlideRecord('sys_user_grmember');
grMembers.addQuery('group.name', group);
grMembers.query();
while (grMembers.next()) {
var userId = grMembers.user;
var taskCheck = new GlideRecord('sc_task'); // or 'task' if you're looking at all task types
taskCheck.addEncodedQuery('assigned_to=' + userId + '^ORclosed_by=' + userId);
taskCheck.setLimit(1);
taskCheck.query();
if (!taskCheck.hasNext()) {
usersNeverAssigned += userId + ",";
}
}
return usersNeverAssigned;
}
- Navigate to: Platform Analytics Administration > Usage and Governance > Reports. Click New
- Configure Report:
Name: Group members without task assignment
Source Type: Table
Table: Group Member [sys_user_grmember]
Filters:
Group → is → [Select your group]
User.Sys ID → is one of → javascript:global.GetNeverAssignedUsers.getUsers('YOUR GROUP NAME HERE');
- In Type tab, set Report Type: List
- In Configure tab, set Group By: None
- Save the report. It will now list only those group members who have never been assigned or closed any sc_task.
If you want to check all task types, change 'sc_task' to 'task' in the Script Include.
If my response helped, please mark it as the accepted solution so others can benefit as well.
