function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ajith Anand2Ajith Anand2 

How to determine the current location of a user

Hi, Kindly help me with the below mentioned requirement.

In an object's detail page, there is a custom button, which on being clicked, should update the record with the geolocation (latitude and longitude) of the user.

Please suggest.

Thanks.
bob_buzzardbob_buzzard
This sounds like you want the Geolocation API : 

https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation

This allows you to capture the lat/long, and you can then update the record using the techniques in this blog (not mine) : 

http://hometeamconsulting.com/update-records-javascript-buttons/

Bear in mind that the user typically has to give permission for their current location to be used.
Ajith Anand2Ajith Anand2
Thank you @bob_buzzard
I was able to extract the geographical co-ordinates with Geolocation API. Any suggestions on how to extract the entire address corrosponding to the co-ordinates?