Skip to content

Commit a9c13f7

Browse files
authored
Add UserLocationUtils for retrieving user location
1 parent b60349f commit a9c13f7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var UserLocationUtils = Class.create();
2+
UserLocationUtils.prototype = {
3+
initialize: function() {
4+
5+
},
6+
getUserLocationCoords: function() {
7+
var user = gs.getUser();
8+
var loc = user.getRecord().location;
9+
if (loc) {
10+
var locGR = new GlideRecord('cmn_location');
11+
if (locGR.get(loc))
12+
return {
13+
latitude: parseFloat(locGR.latitude),
14+
longitude: parseFloat(locGR.longitude),
15+
name: locGR.name.toString()
16+
};
17+
}
18+
return null;
19+
},
20+
21+
type: 'UserLocationUtils'
22+
};

0 commit comments

Comments
 (0)