Skip to content

Commit 301ad73

Browse files
authored
ReadMe.md
1 parent 7700f4b commit 301ad73

File tree

1 file changed

+35
-0
lines changed
  • Server-Side Components/Script Includes/Incident assigned count to assigned to user

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
>**Create a Client-Callable Script Include**
2+
3+
1. Develop a Script Include (assignedtochange) that extends AbstractAjaxProcessor.
4+
5+
2. The Script Include should accept a parameter (the user’s sys_id) passed from a Client Script.
6+
7+
3. It will query the Incident (incident) table to count how many records are assigned to that user.
8+
9+
4. Return the count to the client.
10+
11+
>**Create a Client Script**
12+
13+
1. From the Incident form, the Client Script will call the Script Include using GlideAjax.
14+
15+
2. Pass the Assigned to user’s sys_id as a parameter.
16+
17+
3. Display or use the returned Incident count on the client side (e.g., show a message or populate a field).
18+
19+
Ex.
20+
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
21+
if (isLoading || newValue === '') {
22+
return;
23+
}
24+
25+
//Type appropriate comment here, and begin script below
26+
var aj = new GlideAjax('assignedtochange');
27+
aj.addParam('sysparm_name', 'assigned');
28+
aj.addParam('sysparm_assign', newValue);
29+
aj.getXMLAnswer(answer);
30+
31+
function answer(response) {
32+
alert ("Assigned to has already been an part of " + response + " Incidents");
33+
}
34+
35+
}

0 commit comments

Comments
 (0)