Skip to content

Commit 93891d6

Browse files
Hacktoberfest2025 5th pull request (#2476)
* getAssignedToCount.js * README.md
1 parent 8fcadfe commit 93891d6

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Count Assigned To Field
2+
3+
1. Write a Client Script name as getAssignedToCount
4+
2. Glide the Incident Table
5+
3. Use onChange Client Script
6+
4. Use the Field name as "assigned_to" field
7+
5. Glide the Script Include using "GlideAjax".
8+
6. Call the function "getCount" from Script Include
9+
7. Add the parameter for the newValue.
10+
8. Use the getXML for asynchronous response.
11+
9. Get the answer using the callback function
12+
10. Use the logic for the more than how many tickets that error needs to populate
13+
11. Use the addErrorMessage for marking the error message
14+
12. Use the setValue for the "assigned_to" field.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function onChange(control,oldValue,newValue,isLoading,isTemplate) {
2+
if(isLoading || newValue === '') {
3+
return;
4+
}
5+
6+
var ga = new GlideAjax('countAssignedUtil');
7+
ga.addParam('sysparm','getCount');
8+
ga.addParam('sysparm_assignedto', newValue);
9+
ga.getXML(callback);
10+
11+
function callback(response){
12+
var answer = response.responseXML.documentElement.getAttribute("answer");
13+
if(answer >=5){
14+
g_form.addErrorMessage("Please select another person to work on this Incident, selected user is already having 5 tickets in his/her Queue");
15+
g_form.setValue("assigned_to", "");
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)