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
Shoshinsha81Shoshinsha81 

DISTANCE( BillingAddress, GEOLOCATION(37.750,-122.203), 'mi' ).

I'd like to display the distance between the "BillingAddress" and the given location above "ISTANCE( BillingAddress, GEOLOCATION(37.750,-122.203), 'mi' )  in MILES.

Thanks in advance. :)
 
James LoghryJames Loghry
You'll need to get the BillngAddress's longitude / latitude somehow (such as calling a third party web service or api).  Store that in a location field (presumably on the Account or standard object you're referring to), and then use the Location class and built in Halversine distance calculation method in Apex to calculate the distance. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_system_Location.htm