Skip to content

Commit 1896c64

Browse files
Create LoggedInUsersCountries.js
1 parent e59b3d6 commit 1896c64

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
var getLoggedUserCountryLocs = Class.create();
2+
getLoggedUserCountryLocs.prototype = {
3+
initialize: function() {
4+
},
5+
getCountry: function() {
6+
7+
gs.addInfoMessage(gs.getUserID());
8+
var gr = new GlideRecord('sys_user');
9+
gr.addQuery('sys_id', gs.getUserID());
10+
gr.query();
11+
if (gr.next()) {
12+
var loc = gr.location;
13+
var country = gr.location.country;
14+
}
15+
16+
17+
var grUsers = new GlideRecord('cmn_location');
18+
19+
grUsers.addQuery('country', country);
20+
grUsers.query();
21+
var locs = "";
22+
while (grUsers.next()) {
23+
24+
locs += grUsers.sys_id + ",";
25+
}
26+
gs.addInfoMessage(locs);
27+
var users = new GlideRecord('sys_user');
28+
users.addQuery('location', 'IN', locs);
29+
users.query();
30+
31+
var l = "";
32+
while (users.next()) {
33+
34+
l += users.sys_id + ",";
35+
36+
}
37+
return 'sys_idIN' + l;
38+
},
39+
40+
type: 'getLoggedUserCountryLocs'
41+
};

0 commit comments

Comments
 (0)