Thursday, 19 May 2011

Simple Google Maps in MS Dynamics CRM 4.0

Lately I've been looking at adding google maps to our MS Dynamics CRM 4.0 install. While there are plenty of guides to adding it yourself, most seem overly complex for the task required or need a lot of editing to be functional. Here's a quick, general-use case for adding embedded google maps to CRM 4 entities.

A few notes:
  • All hard-coded variables should work on these entities: Account, Contact, Business unit, and Competitor. For custom entities, you'll need to change the variables.
  • This assumes you're putting the map in an iframe on it's own tab. You'll need to know the names of both.
  • It performs no input validation or removal of illegal characters. Malformed addresses might display incorrectly as a result.

This code should go in the onload form of the entity:

//// Simple Embedded Google Maps in an iframe ////

var maptab = crmForm.all.tab2Tab; // your map tab here
var mapiframe = document.all.IFRAME_map; //your iframe name here

// Load map when the map tab is clicked
maptab.onclick = function() {

//// Loads map into iframe when called //
DrawMap = function() {
    if (crmForm.FormType == 1)
    { mapiframe.src = "about:blank"; }
        // Build the address for google maps 
        var mapUrl = "";
        if (crmForm.all.address1_line1.DataValue != null) 
            { mapUrl = mapUrl + crmForm.all.address1_line1.DataValue + "+"; }
        if (crmForm.all.address1_line2.DataValue != null) 
            { mapUrl = mapUrl + crmForm.all.address1_line2.DataValue + "+"; }
        if (crmForm.all.address1_line3.DataValue != null) 
            { mapUrl = mapUrl + crmForm.all.address1_line3.DataValue + "+"; }
        if (crmForm.all.address1_city.DataValue != null) 
            { mapUrl = mapUrl + crmForm.all.address1_city.DataValue + "+"; }
        if (crmForm.all.address1_stateorprovince.DataValue != null) 
            { mapUrl = mapUrl + crmForm.all.address1_stateorprovince.DataValue + "+"; }
        if (crmForm.all.address1_country.DataValue != null) 
            { mapUrl = mapUrl + crmForm.all.address1_country.DataValue; }
        //Check if there's no address information
        if ( mapUrl == "" )
            mapiframe.src = about:blank;
        else {
            mapUrl = "" + mapUrl + "&output=embed&t=m";
            mapiframe.src = mapUrl;

What this does:
  • Waits for the map tab to be clicked and then calls the DrawMap function (this saves time loading the form)
  • Checks to see if the entity is being created, in which case it will blank out the map.
  • Loads any address values that contain data into mapUrl value
  • Checks that the address actually contains data, and if so:
  • Loads that url into the iframe.
At the end of it, you have something that looks like this:

My example here is slightly different - if selected, the radio buttons above will re-load with directions from our office.

It's surprising just how much you can do by passing parameters in the google maps URL. This example defaults to 'embedded' viewing with output=embed and t=m, but you can use it for quite a few other things like getting directions using saddr and daddr, pull up streetview with cbp=, and a whole range of other things. Mapki seems to have a pretty good list of the known parameters here.

You can quickly and easily integrate google maps with CRM 4, and it makes a lot of tasks incredibly easy. With only a little more work, you could have it throwing up a list of directions from any arbitrary point to any address in your system.


  1. CRM are the best software that any company could rely on to maintain their relationship with their customers. Apart from other CRM in the market Salesforce offers a great interface to take care of these activities. They also offer in house interaction facility. Thanks to salesforce.

    Salesforce developer training in chennai
    Salesforce administrator training in chennai


    1. - Tộc trưởng, số người trong viễn cổ hổ tộc vô cùng nhiều, chúng ta làm sao để cứu người?

      Nhạc Hạo tiến tới hỏi Nhạc Thành.

      - Chuyện cứu người mọi người không cần phải lo lắng, ở trong Viễn Cổ Hổ Tộc, chỉ cần gặp người của bọn họ là giết không tha.

      Nhạc Thành bình tĩnh trả lời.

      - Vậy còn nhữndongtam
      mu private
      tim phong tro
      nhac san cuc manh
      tổng đài tư vấn luật
      văn phòng luật
      tổng đài tư vấn pháp luật
      thành lập công ty
      chém gió
      trung tâm ngoại ngữg phụ nữ trẻ em thì sao?

      Nhạc Hạo cất tiếng hỏi Nhạc Thành.

      Sắc mặt của Nhạc Thành biến hóa, hắn suy nghĩ một lúc rồi nói:

      - Nếu Hắc Ám Thần Điện cùng Tam Đại Thú Tộc tới Nhạc gia thì sẽ tha cho phụ nữ và trẻ em của Nhạc gia hay sao, chỉ cần là người của Viễn Cổ Hổ Tộc thì giết không ta, tuy nhiên chúng ta bỏ qua người bình thường cũng là việc nên làm, còn người tu luyện thì một người cũng không bỏ

  2. There are lots of information about latest technology, like Hadoop cluster is a special type of computational cluster designed specifically for storing and analyzing huge amounts of unstructured data in a distributed computing environment. This information seems to be more unique and interesting. Thanks for sharing.
    Hadoop Training Chennai | Best Hadoop Training in Chennai | Big Data Training

  3. Welcome to Wiztech Automation - Embedded System Training in Chennai. We have knowledgeable Team for Embedded Courses handling and we also are after Job Placements offer provide once your Successful Completion of Course. We are Providing on Microcontrollers such as 8051, PIC, AVR, ARM7, ARM9, ARM11 and RTOS. Free Accommodation, Individual Focus, Best Lab facilities, 100% Practical Training and Job opportunities.

    Embedded System Training in chennai
    Embedded System Training Institute in chennai
    Embedded Training in chennai
    Embedded Course in chennai
    Best Embedded System Training in chennai
    Best Embedded System Training Institute in chennai
    Best Embedded System Training Institutes in chennai
    Embedded Training Institute in chennai
    Embedded System Course in chennai
    Best Embedded System Training in chennai

  4. Cloud servers are the best in safe guarding one's information thorugh online. Without this dedicated methodology many companies would have not existed at all. The same though has been furnished above. Thanks for sharing this worth while content in here. Keep writing article like this.

    Salesforce Training in Chennai | Salesforce training | Salesforce admin training in chennai

  5. Best SQL Query Tuning Training Center In Chennai This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..

  6. Great blog..You have clearly explained about the concept..Step by step explanation is too good to understand..Its very useful for me to understand..Keep on sharing..
    Hadoop training in chennai

  7. Thanks for sharing informative article on java application development. Your post helped to understand the career in Java. JAVA Training in Chennai

  8. Thanks for sharing this informative content which provided me the required information about the latest technology.
    Salesforce training in Chennai | Salesforce CRM training in Chennai

  9. In coming years, cloud computing is going to rule the world. The cloud based CRM tool provider like Salesforce have massive demand in the market. Thus talking salesforce training in Chennai from reputed Salesforce training institutes in Chennai will ensure bright career prospects for aspiring professionals.

  10. Every business requirement is different so before selecting the CRM software organization should keep in mind the various factors. CRM Philippines

  11. Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. crmcare

  12. Many thanks for creating the effort to talk about this, I feel strongly about this and love learning a great deal more on this subject. If feasible, as you gain knowledge, would you mind updating your website with a great deal more information? It’s extremely beneficial for me. crm software hong kong, malaysia, singapore

  13. I’d love to be a part of group where I can get advice from other experienced people that share the same interest. If you have any recommendations, please let me know. Thank you.
    fire and safety course in chennai

  14. Emotion Spitfire SOT inflatable kayak is stable and tracks well in moderate water conditions.

    1 person recreational sit on top kayak

  15. Really i found this article more informative, thanks for sharing this article! Also Check here

    Download and install Vidmate App which is the best HD video downloader software available for Android. Get free latest HD movies, songs, and your favorite TV shows

    Vidmate App Download

    Vidmate apk for Android devices

    Vidmate App

    download Vidmate for Windows PC

    download Vidmate for Windows PC Free

    Vidmate Download for Windows 10

    Download Vidmate for iOS

    Download Vidmate for Blackberry

    Vidmate For IOS and Blackberry OS

  16. Lucky Patcher Apk
    Lucky Patcher
    Lucky Patcher App
    How to Use Lucky Patcher App
    How to Use Lucky Patcher Apk

    Lucky Patcher smile could be a must-have hacking app for all the crazy gamers.
    This app helps in modifying most of the android games so the games will be enjoyed to the fullest.
    It additionally lets us modify numerous applications in many ways Lucky Patcher Download.
    Lucky Patcher smileis an incredible tool that permits you to block advertisements, take away system apps, modify system apps, bypass license verification, modify app permissions, and for a lot of.

  17. Ingramer will automate liking, following and unfollowing just like a human being would. We offer this at a price where people would consider it as almost free.

    best instagram bot

  18. And we’ll even GUARANTEE* that offer and can have a check in your hand in as little as 5-10 business days. Just to review, we’re not looking to list your house, we are local direct cash home buyers.

    We Buy Houses Elm Grove WI

  19. Mar Jaayein Hum Lyrics from Shikara is Latest Hindi song sung by Papon, Shradha Mishr

    bollywood songs lyrics

  20. . Also, this water-based emulsion is so fast that it only takes a few minutes before it starts its action gets rid of the corrosion.

    Why Turtle Wax T-280RA Chrome Polish & Rust Remover?

  21. Light weight, disposable particulate dust / mist / flu / coronavirus respirator. These respirators meet the requirements of EN149:2001 category FFP1 which protects the wearer from non-toxic solid aerosols offering excellent repiratory protection

    coronavirus face mask

  22. As the Wuhan coronavirus continues to spread, officials in China are urging citizens to wear masks in public to stop the spread of the virus — and cities in China as well as other parts of Asia are reportedly running out of face masks.
    But can a mask really keep you from catching the virus?
    Coronavirus Approved Face Masks & Respirators

    coronavirus mask


  23. With more people out and about during the summer months, buy mobile traffic to catch them right where they are at. One of your best prospects might be on vacation standing in a three-hour line at Disney right now waiting to ride a rollercoaster and is killing time getting a jump on their business goals trying to find YOU! All mobile traffic comes from iOS and Android devices. You can even target a category!

    Buy Mobile Traffic

  24. Eyal Nachum is a fintech guru and a director at Bruc Bond. Eyal is the architect of the software that SMEs use to do cross-border payments.

    Cross-border payments

  25. Alleen op die manier kunt u er zeker van zijn dat alles zonder zorgen zal verlopen. Het is dan ook belangrijk om te weten dat wij een specifieke werkwijze hanteren om dit altijd op de juiste wijze te verzorgen.

    Verhuisbedrijf Den Haag en Rotterdam

  26. Als u zelf uw kind wil gaan helpen, moet u natuurlijk wel weten wat redactiesommen eigenlijk zijn. Bij redactiesommen zit de som verwerkt in een verhaal. Het worden dan ook wel verhaaltjessommen genoemd. Waar deze verhaaltjes eerst nog vrij eenvoudig en kort zijn, worden de redactiesommen in groep 8 steeds ingewikkelder.

    redactiesommen oefenen

  27. Als je een partytent huurt is het belangrijk om ook aan de aankleding en inrichting te denken. Het is wel zo praktisch om dat ook bij Colors Events te regelen. Wij kunnen behalve jouw partytent ook zorgen voor meubilair zoals statafels, al dan niet voorzien van rokken, stoelen of gewone tafels. Ook feestverlichting mag niet ontbreken als je een feest in de avonduren organiseert


  28. Bijna alle leerlingen hebben wel eens moeite met een bepaald vak. Een klein steuntje in de rug is dan vaak genoeg om het verschil te maken in hun cijfers. Dat steuntje in de rug zijn wij. Excellent Academy beschikt over zeer kundige docenten, die de leerling helpen om net dat verschil te maken.
    engels cursus den haag

  29. Webactueel schakel je in als je een maatwerk WordPress website laten maken wilt. Door een maatwerk website te ontwikkelen is het mogelijk om meer leads te genereren. Daarbij hebben we altijd oren voor de wensen en eisen die jij als ondernemer hebt als het om jouw website gaat. Bovendien gaat het om meer dan alleen een website. Ook het toepassen van de juist online marketingstrategie helpt hier in grote mate bij. Wij kunnen dit allemaal voor je verzorgen.

    Bekijk website

  30. Webactueel schakel je in als je een maatwerk WordPress website laten maken wilt. Door een maatwerk website te ontwikkelen is het mogelijk om meer leads te genereren. Daarbij hebben we altijd oren voor de wensen en eisen die jij als ondernemer hebt als het om jouw website gaat. Bovendien gaat het om meer dan alleen een website. Ook het toepassen van de juist online marketingstrategie helpt hier in grote mate bij. Wij kunnen dit allemaal voor je verzorgen.
    Lees meer

  31. Zonder al te veel poespas gewoon een nieuwe, strakke en frisse wandafwerking? Dan is het spuiten van latex muurverf een goede uitkomst. En ook dan moet je bij Latex Spuiten XXL zijn. Het hanteren van de speciale spuiten voor latexverf hebben wij ons in de loop der jaren eigen gemaakt. Door de spuittechniek ontstaat er een egale structuur, die een stuk strakker is dan bij het sauswerk met een traditionele verfroller. Bovendien is de klus een stuk sneller geklaard – ondanks dat we de werkzaamheden minstens zo gepassioneerd als traditioneel binnenschilderwerk uitvoeren. Latex spuiten is daarom doorgaans voordeliger dan latexen met de verfroller. Disclaimer: dit is afhankelijk per situatie en oppervlakte.

    muurverf spuiten