Returns a decimal value, which is the distance between the first and the second
locations whose geographic coordinates are passed as parameters to the distanceBetween function.
The unit of the distance can be kilometers or miles based on the value of the distanceUnit
parameter.
Required Editions
Available in: Lightning Experience in Professional, Unlimited, and
Enterprise Editions that have Consumer Goods Cloud enabled.
Parameters
lat1Deg: The decimal value representing latitude in degrees (-90 to 90) of the first
location.
lon1Deg: The decimal value representing longitude in degrees (-180 to 180) of the first
location.
lat2Deg: The decimal value representing latitude in degrees (-90 to 90) of the second
location.
lon2Deg: The decimal value representing longitude in degrees (-180 to 180) of the second
location.
distanceUnit: An optional parameter of String type. If the distanceUnit parameter is set to
miles, the distance between the two locations is calculated in miles. Otherwise, the distance
between the two locations is calculated in kilometers.
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.