1

I saw this app that adds a map to the Lead object: enter image description here

How can I do something similar?

4

Supporting @Adrian's comment, I am providing my answer.

Rather than using "Google Maps API" (which is not fully FREE), I have used <apex:map> component which is in-build in Salesforce and takes the salesforce data.

We do not need to call any other external api to pass the data.

It has following features:

Display an interactive, JavaScript-based map, complete with zooming, panning, and markers based on your Salesforce or other data.

<apex:map> doesn't, by itself, display map markers, even for the center point. To display up to 100 markers, add child components.

    <apex:map width="500px" height="175px" zoomLevel="15" mapType="roadmap" 
                                    center="{!accountObj.ShippingStreet},{!accountObj.ShippingCity},{!accountObj.ShippingState}">
      <apex:mapMarker title="{!accountObj.Name}" 
                                position="{!accountObj.ShippingStreet},{!accountObj.ShippingCity},{!accountObj.ShippingState}"/>
   </apex:map> 

For more information refer apex:map

If you want to create lightning component using map then refer Creating Account Map Component in the trailhead.

| improve this answer | |
3

This is pretty broad, but to point you in the right direction you'd need to add a Visualforce Component to the Page Layout of the record.

The Visualforce Page itself would need to use a standard controller so you could access relevant address fields of the Lead, then use Google Maps API to display and show the map on the page which you could probably do using JavaScript, passing in the address of the record you're on to the API and getting it's location returned.

| improve this answer | |
  • 1
    Or the <apex:map> component, which can geocode up to ten markers. – Adrian Larson Jan 12 '17 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.