Loading
Visual Studio Code Based Modeler for Consumer Goods Cloud
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          distanceBetween(lat1Deg, lon1Deg, lat2Deg, lon2Deg, distanceUnit)

          distanceBetween(lat1Deg, lon1Deg, lat2Deg, lon2Deg, distanceUnit)

          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.

          Returns

          A decimal value.

          Sample Usage

          Utils.distanceBetween(35.1495,90.0490,33.7490,84.3880,"miles")

           
          Loading
          Salesforce Help | Article