diff --git a/Server-Side Components/Script Includes/Count Assigned To Field/README.md b/Server-Side Components/Script Includes/Count Assigned To Field/README.md new file mode 100644 index 0000000000..2da948e101 --- /dev/null +++ b/Server-Side Components/Script Includes/Count Assigned To Field/README.md @@ -0,0 +1,12 @@ +Count Assigned To Field + +1. Create a Script Include +2. Enable Client Callable +3. create a Function in the Script Include Class +4. Do Glide Aggregate to the Incident Table +5. Get the Parameter from the Client Script +6. Use the Aggregate - COUNT for the assigned_to field +7. Use the While Loop +8. Get the COUNT of the assigned_to field +9. Return the COUNT to Client Script +10. Based on the COUNT we can add limit the assignment of the tickets to the assigned users. diff --git a/Server-Side Components/Script Includes/Count Assigned To Field/countAssignedUtil.js b/Server-Side Components/Script Includes/Count Assigned To Field/countAssignedUtil.js new file mode 100644 index 0000000000..ebb1cbfd51 --- /dev/null +++ b/Server-Side Components/Script Includes/Count Assigned To Field/countAssignedUtil.js @@ -0,0 +1,15 @@ +var countAssignedUtil = Class.create(); +countAssignedUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, { + + getCount: function() { + var ga = new GlideAggregate('incident'); + ga.addQuery('assigned_to', this.getParameter('sysparm_assignedto')); + ga.addAggregate('COUNT', 'assigned_to'); + ga.query(); + while (ga.next()) { + var assignedIncident = ga.getAggregate('COUNT', 'assigned_to'); + return assignedIncident; + } + }, + type: 'countAssignedUtil' +});