- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 07:23 AM
My client uses the Locations table in order to provide a mapping of all servicable assets for our technicians. However, a new request has come in to be able to search for these locations based on the input of coordinates. They are asking to narrow down to locations nearest to inputted coordinates with maximum distance of 500 meters.
Is there a script that can help calculate distance and convert that to meters?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 08:44 AM
Check if this is helpful
https://stackoverflow.com/questions/5260423/torad-javascript-function-throwing-error
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 12:57 PM
I have a more significant question:
Does ServiceNow support Math libraries? Do I need to include them in my script include?
See here for what I am trying to do:
https://www.movable-type.co.uk/scripts/latlong.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 06:32 AM
Bump. Does anyone know how to include the math library in Javascript for ServiceNow Script Include?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 07:29 AM
Yes. ServiceNow supports math library. You dont need to include it. The calculation there in the link should work.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 08:37 AM
It doesn't. Tracking the result of the toRadians function returns undefined.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 08:44 AM
Check if this is helpful
https://stackoverflow.com/questions/5260423/torad-javascript-function-throwing-error
Please mark this response as correct or helpful if it assisted you with your question.