• Gatorrr7
  • 10 Points
  • Member since 2019

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 3
please correct this code and help me earn this badge ...have completed all tasks ..except this one ....

IF( MONTH( NOW() ) = 12,
  DATE( YEAR( NOW() ), 12, 31 ),
  DATE( YEAR( NOW() ), MONTH( NOW() ) + 1, 1) - 1
I would like to create a visualforce page that will use the address of a Contact in Salesforce, and determine which one of our ground campus locations is the closest, and display the campus name and distance. I assume that I would need the Latitude, Longitude coordinates for each campus, then somehow tie that into the directions portion of Google Maps... But I'm honestly not sure where to begin with this.
I have found this page: 


which goes into some detail about using the "distance formula" but I am new to Apex coding and using geolocation information, and I don't know how I would access the directions function of Google Maps to utilize and compare the distances to each campus, then display the smallest value/distance.

Any input would be greatly apreciated!
  • December 21, 2015
  • Like
  • 0
i am trying to build a lightning component that shows nearby contacts based on the users current location. i am getting an error when trying to access the users current location through navigator.geoLocation. I get the following error.
"Uncaught error in actionCallback : navigator.geoLocation is undefined"

Here is my component and its controller logic.

<aura:component >
   <aura:attribute name="latitude" type="Decimal"/>
    <aura:attribute name="longitude" type="Decimal"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
	doInit : function(component, event, helper) {
            console.log("capability is there");
            console.log("No Capability");
            this.longitude=component.set("v.longitude", position.coords.longitude);
            console.log("Latitude is:"+this.latitude);
            console.log("Longitude is:" +this.longitude);
debugging  console log shows that my else part is only written to console. does that mean that geolocation is not supported in lightning? Am i doing anything wrong ? Any help would be appreciated.