Skip to content

Commit 6c56488

Browse files
authored
scriptUtil.js
This script include handles the sysIds(oldValue & newValue) of users and returns the display name
1 parent 2282597 commit 6c56488

File tree

1 file changed

+36
-0
lines changed
  • Client-Side Components/Client Scripts/Detect oldValue newValue and Operation in Glide List Type Fields

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
var scriptUtil = Class.create();
2+
scriptUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
3+
4+
5+
getWatchListUsers: function() {
6+
7+
var oldUsers = this.getParameter('sysparm_old_values');
8+
var newUsers = this.getParameter('sysparm_new_values');
9+
10+
var result = {
11+
oldU: this._getUserNames(oldUsers),
12+
newU: this._getUserNames(newUsers)
13+
};
14+
15+
return JSON.stringify(result);
16+
},
17+
18+
_getUserNames: function(userList) {
19+
var names = [];
20+
21+
var grUserTab = new GlideRecord('sys_user');
22+
grUserTab.addQuery('sys_id', 'IN', userList);
23+
grUserTab.query();
24+
if (grUserTab.hasNext()) {
25+
while (grUserTab.next()) {
26+
names.push(grUserTab.getDisplayValue('name'));
27+
}
28+
return names.toString();
29+
} else {
30+
return 'No record found';
31+
}
32+
33+
},
34+
35+
type: 'scriptUtil'
36+
});

0 commit comments

Comments
 (0)