I want to fetch location in work note field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In FSM module, I want to get agent current location to fetch and add in work note from user table.
Is there any property there so I can enable it and I can get latitude and longetude in user table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
what would be the scenario?
If you want to display such values, the work notes are not the best option. Imagine - the value is copied to WN and then somebody else adds another WN and the detail is lost or difficult to find again.
It would be also better for filtering the data and eventual reporting.
Wouldn't it make sense maybe to add a field to display that? It can be read-only or under some tab/section...
No AI was used in the writing of this post. Pure #GlideFather only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
You could use a business rule defined on the table that runs Before for Insert and Update. And the following script in the Advanced tab.
(function executeRule(current, previous /*null when async*/) {
// get latitude and logitude of the current user
var usrID = current.assigned_to.toString(); // or Agent name if on the record being created/updated
var usr = new GlideRecord('sys_user');
usr.addQuery('sys_id', usrID);
usr.query();
if (usr.next()) {
var lat = usr.location.latitude;
var lon = usr.location.longitude;
// gs.info('User : ' + usr.name + ', lat: ' + lat + ', long: ' + lon);
current.work_notes = 'Agent: ' + usr.name + ', latitude: ' + lat + ', longitude: ' + lon;
}
})(current, previous);
(Tested in a BR for the incident table)
A system property is not going to fetch a user's location latitude and longitude values that I'm aware of.