- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2023 07:12 PM - edited 07-26-2023 07:14 PM
Network Group manager wants to automate assigning tasks to members of the group. When a new incident is assigned to this group and it is not assigned to anyone, a configuration/script will assign it in a round robin assignment to the member.
Note: Assign 10 members to the group.
For the SLA of the incident:
- Auto-Notifications should be sent out by the tool for:
- Tickets nearing SLA breach 70%.
- Tickets that breached the SLA 100%.
- Recipient of the notices should be the assigned support team.
Is it possible to get all group members number of assigned incidents or task, then the assigned to will be the group member with the smallest number of assigned task.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 11:26 PM
Hi Atulya, not sure what is Advance Work Assignment, I'm super new in ServiceNow, I just started studying June of this year.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 12:58 AM
Sorry , I am not a coder / pro 🙂 , but my recommendation to use modules instead of scripting.
Please accept my answer as solution or mark it helpful.
Regards
Atul G
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2023 01:12 AM
Greetings!!
Not sure, but did you try advance work Assignment.
Please mark this response as correct or helpful or the solution accepted if it assisted you with your question.
Regards
Atul G.
Learn N Grow With Atul G
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 11:26 PM
Hi Atulya, not sure what is Advance Work Assignment, I'm super new in ServiceNow, I just started studying June of this year.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 02:37 AM
Here is the script which checks the ticket count and assigns to member who has lowest ticket assigned.
Script:
var groupName = current.assignment_group;
// Get a list of members for this group
var members = [];
var gm = new GlideRecord('sys_user_grmember');
gm.addQuery('user.active', true);
gm.addQuery('group', groupName);
gm.orderBy('user');
gm.query();
while (gm.next()) {
members.push(String(gm.user));
}
// Get a list of their open ticket counts
var counts = [], agg, count;
for (var i = 0; i < members.length; i++) {
count = 0;
agg = new GlideAggregate('sn_sm_finance_task');
agg.addActiveQuery();
agg.addQuery('assignment_group', groupName);
agg.addQuery('assigned_to', members[i]);
agg.orderBy('assigned-to');
agg.addAggregate('COUNT');
agg.query();
if (agg.next())
count = agg.getAggregate('COUNT');
counts.push(count);
}
// find the minimum count and store its index
// we cannot use .sort().shift() or we won't know where to look in the members array
var min = counts[0];
var index = 0;
for (var j = 1; j < counts.length; j++) {
if (counts[j] < min) {
min = parseInt(counts[j]);
index = parseInt(j);
}
}
// get the member with the lowest count
var userID = members[index];
var h;
// Log their name to verify
var user = new GlideRecord('sys_user');
user.orderBy('name');
if (user.get(userID)) {
h = user.sys_id;
}
current.assigned_to = h;
current.update();
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 05:58 AM
Hey Harish KM,
I'll test it out soon, the code you provided has given me an idea, thanks.