Friday, January 18, 2019

Lightning:map - Way to display location on map either by using address or geo-location

Salesforce introduces new tag in lightning framework "lightning:map" which can be used to securely displays map of one location or many locations.

You can either use address (make sure postalcode,country are specified) or geolocation (latitude and longitude).

Below is syntax to use lightning:map


where mapMarkers is an array of marker to display location. Below is JSON sample for markers:

"location": {
"Country": "USA",
"State": "CA"
"icon": "standard:account",
"title": "Western Telecommunications Corp.",
"description": "CA,USA"
"location": {
"City": "Lawrence",
"Country": "USA",
"PostalCode": "66045",
"State": "KS"
"icon": "standard:account",
"title": "Dickenson plc",
"description": "Lawrence,KS,66045,USA"

If you know geo-location of address then, you can pass latitude and longitude in location as shown below:

    location: {
'Latitude': '37.790197',
'Longitude': '-122.396879'
    title: 'Western Telecommunications Corp',
    description: 'Western Telecommunications Corp',
    icon: 'standard:account'

I have created a sample lightning component which fetch account billing address and display it on google maps using Lightning:map tag.

Complete Code:

  • If you specify address, then you must specify City, PostalCode, State or Country.
  • If you specify both address and geo-location, then map will be plotted using latitude and longitude.
  • If any mapMarker is invalid, then nothing will be plotted on map even other map markers.

Hope this will help!!!


  1. Atocloud have designed solution to display all of its accounts on the google map for one of there clients in both lightning and classic, where user can select type of record he wants to search (Account, contact or any custom object). This solution has three section

  2. Atocloud have designed solution to display all accounts on the google map in both lightning and classic, where user can select type of record he wants to search (Account, contact or any custom object).

  3. Started out in 2012, Data Science Central is one of the industry’s leading and fastest growing Internet
    community for data practitioners. Whether it is data science or machine learning or deep learning or
    big data, Data Science Central is a one-stop shop that covers a wide range of data science topics that
    includes technology, tools, data visualisation, code, and job opportunities. Also, many industry experts
    contribute to the community forum for discussion or questions.

    DATA SCIENCE Training in OMR Chennai

  4. We have sell some products of different custom is very useful and very low price please visits this site thanks and please share this post with your friends. what county am i in now

  5. I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post. garmin gps updates free 2016


  6. You write this post very carefully I think, which is easily understandable to me. Not only this, but another post is also good. As a newbie, this info is really helpful for me. Thanks to you.
    Tally ERP 9 Training
    tally classes
    Tally Training institute in Chennai
    Tally course in Chennai

  7. Myra Condo by Selangor Dredging Berhad. Hotline 61009266. Get Discounts, Direct Developer Price, Brochure, Floor Plan, Price List. Upcoming new launch at Potong Pasir Myra Condo