SugarTip – How to… Insert a location map into Account details

sugarcrmdevelopers —  September 23, 2011 — 11 Comments

Mike works for EnableIT SugarUK, an award winning SugarCRM EMEA Gold Partner based in Ipswich, UK and as well as being the primary wordsmith on their blog has been a contributing author on CRMOutsiders since earlier this year. Following recent changes within the SugarCRM camp as to what content will be appearing on the SugarCRM Developer Blog and CRMOutsiders, he finds himself now also posting within the walls of Developer Blog. Following on with the trend of his SugarCRM Tip of the Day articles on CRMOutsiders where he previously posted useful tips on how to get that little bit more from your SugarCRM system, he will now be posting those “How Tos” to the developer blog instead, leaving his CRMOutsiders posts to be more CRM Market based, rather than focussing specifically on SugarCRM.

OK, so here’s your starter. Have you ever wanted to create functionality within your SugarCRM system to be able to see (on a tab within a record) where your customer is located? If so, then read on…

I will be using Google Maps to provide the location maps in this tip, however, it only requires a simple replacement of the relevant code with the search string from your favourite on-line map provider to get the same functionality.

In the SugarCRM Studio, you will need to create a field which will be added to your DetailView layout (preferably in a separate Maps tab to save it loading every time you look at the account details).

Go to the Accounts module and click on Fields.

Click on Add Field and in the Data Type drop-down, select IFrame>

Enter the Field Name as something like maps with a Display Label of something like Location Map

In the Default Value use the search string for your map provider.

For Google Maps this is


You will now need to customise the string to automatically look up the address of the Account whose record you are currently in.

To do this, move your cursor to the section in the search string where the ACCOUNT_ADDRESS is required and then put the tick (if it isn’t already there) in the Generate URL check-box.

In the drop-down list, select billing_address_postalcode and click on Insert Field.

Your Default Value should now read{billing_address_postalcode}&output=embed

I recommend that you put an IFrame Height of 400 to give a decent enough map size to see the location properly.

Once you have saved the field away, simply add it to the correct location on your DetailView for the Account module (you don’t need it on the EditView because it’s a dynamically created field with no user-definable content) to get the Account’s location displaying (subject to there being a valid Postal/Zip code in the Account’s address details.


This is a very useful customisation if your sales team/consultants etc. need to be able to quickly see where that meeting they are attending is being held. As it is pulling Google Maps directly into your SugarCRM system, you have full access to the different map types (road, satellite etc.).

11 responses to SugarTip – How to… Insert a location map into Account details


    Hi, and thanks for the tip. Now I’d like to get it working in my CRM as it would be really convenient and usefull. What happens is that gmaps shows USA, UK, Jakarta, and one time Angers in France. The last was ok. I live in France. What’s happening there ? Is there a way to get it function here ?


    Tip for countries without postal codes: use {billing_address_street}%20{billing_address_city}


      Hi Bernardo, thanks for answering.
      We do have a postal code. I tried to put the code like you show in your message, but it doesn’t work.
      When I put : “{billing_address_street}%20{billing_address_city}%20{billing_address_postal_code}&output=embed” it shows up Europe.
      When I put the exact line like in your message, it almost shows the place. always around but never the right place. Google maps does not have this problem with these adresses (I checked).


    I tried this, the map didn’t show so I went back to the field section to edit and I can’t find the field.
    I try to add it again and 6.3RC1 tells me the field exists, but it doesn’t show in the list of fields under account?


    I think that’s not the best way to achieve this since you create a field in the database to save dynamic content…
    A much simplier way is to create a fake field in the detailview metadata that you name whatever you want and assign custom code to it with the same syntax:


    I get what looks like a similar result to Rob: the map is nearly there, the marker is just outside the frame -Is there a way to get the marker in the centre?


    I do not have an option of “Iframe” for the data type….the closest I come to is “Web Link”…why is this? How can I have “IFrame” as an option for data type?


    I created this iFrame a few days ago and everything worked smoothly, until I moved the field inside it’s own panel and collapsed it by default. The idea was to give the user space enough to view all Account record keeping the map away until it needed to be seen.
    When extending the panel, the iFrame doesn’t get updated or centered in right location. You’ll get a poorly defined map centered in Antartica! However, if you navigate through the map, and zoom it to the right location, you can see red mark in the right place.

    Any clue on how do deal With this?

    P.S. – I’m using SugarCRM CE 6.5


    I tried to do this on 7.8 enterprise and not even displaying the map, i followed stey by step

Trackbacks and Pingbacks:

  1. url encode fields in iframe url - January 3, 2013

    […] […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s