Skip to content

Commit 714032d

Browse files
Limit Assigned To (#2455)
* countAssignedUtil.js * README.md
1 parent 1106276 commit 714032d

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Count Assigned To Field
2+
3+
1. Create a Script Include
4+
2. Enable Client Callable
5+
3. create a Function in the Script Include Class
6+
4. Do Glide Aggregate to the Incident Table
7+
5. Get the Parameter from the Client Script
8+
6. Use the Aggregate - COUNT for the assigned_to field
9+
7. Use the While Loop
10+
8. Get the COUNT of the assigned_to field
11+
9. Return the COUNT to Client Script
12+
10. Based on the COUNT we can add limit the assignment of the tickets to the assigned users.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var countAssignedUtil = Class.create();
2+
countAssignedUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
3+
4+
getCount: function() {
5+
var ga = new GlideAggregate('incident');
6+
ga.addQuery('assigned_to', this.getParameter('sysparm_assignedto'));
7+
ga.addAggregate('COUNT', 'assigned_to');
8+
ga.query();
9+
while (ga.next()) {
10+
var assignedIncident = ga.getAggregate('COUNT', 'assigned_to');
11+
return assignedIncident;
12+
}
13+
},
14+
type: 'countAssignedUtil'
15+
});

0 commit comments

Comments
 (0)