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() {
    DrawMap();
}

//// Loads map into iframe when called //
DrawMap = function() {
    if (crmForm.FormType == 1)
    { mapiframe.src = "about:blank"; }
    else
    {
        // 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 = "http://maps.google.com/?q=" + 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.

58 comments:

  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

    ReplyDelete
    Replies

    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
      http://nhatroso.com/
      nhac san cuc manh
      tổng đài tư vấn luật
      http://dichvu.tuvanphapluattructuyen.com/
      văn phòng luật
      tổng đài tư vấn pháp luật
      thành lập công ty
      http://we-cooking.com/
      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ỏ

      Delete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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..

    ReplyDelete
  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

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

    ReplyDelete
  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

    ReplyDelete
  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.

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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

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

    1 person recreational sit on top kayak

    ReplyDelete
  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

    ReplyDelete
  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.

    ReplyDelete
  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

    ReplyDelete
  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

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

    bollywood songs lyrics

    ReplyDelete
  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?

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete

  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    Bezoek: colorsevents.nl

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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


    ReplyDelete
  32. Your Website is very good, Your Website impressed us a lot, We have liked your website very much.
    We have also created a website of Android App that you can see it.

    http://damodapk.com/

    ReplyDelete
  33. Your Website is very good, Your Website impressed us a lot, We have liked your website very much.
    We have also created a website of Android App that you can see it.

    http://infotodaypk.com/

    ReplyDelete
  34. Your Website is very good, Your Website impressed us a lot, We have liked your website very much.
    We have also created a website of Android App that you can see it.

    http://damodapk.com/

    ReplyDelete
  35. Your Website is very good, Your Website impressed us a lot, We have liked your website very much.
    We have also created a website of Android App that you can see it.

    http://infotodaypk.com/

    ReplyDelete
  36. 우리카지노 100%안전 검증된 카지노사이트 만 엄선하여 소개해드립니다 국내 업계1위 우리카지노계열 전통이 있는 온라인카지노 에서 안전하고 편안한 게임을 ..
    우리카지노

    ReplyDelete
  37. Prime Crack is a free site to download 100% working Cracked Software With Serial Key Activator Crack & Full Version Free Download.


    Adobe Photoshop CC Crack

    ReplyDelete
  38. We are one of the UK's Leading Suppliers and Manufacturers of ALL Face Masks. Our range includes all types of Respiratory Protection products meeting various regulations including FFP1, FFP2, FFP3, N65, N95 and N99. Our range includes Valved and Non Valved Respirators, Disposable Dust and Face Masks, Medical, Dental, Hygiene, Surgeons Protective 3 Ply Face Masks. We also stock reusable Face Masks and Respirators



    Face Masks





    ReplyDelete
  39. We have grown into one of the UK's leading suppliers of PPE Personal Protective Equipment, PPE, Face Masks including Surgical, Dental, Hygiene, Medical, FFP1, FFP2, FFP2, N95, N99 and all Respirators plus a massive range of Industrial Supplies with a multi- million pound turnover.
    For more information on our company or a copy of our latest catalogue please do not hesitate to contact us on 01268 768 768, thank you.

    FFP3 Face Mask UK

    ReplyDelete
  40. NEONICE sandals factory specializes in sandals production technology experts, mainly produces PVC, EVA, TPR, PU, rubber and plastic materials such as sandals and flop flops. Starting business since 2008, 10 million pairs of sandals producing and exporting every year. Which can ensure the normal delivery period of each customer. Guarantee quality.

    Our sandals manufacturer focus on custom flip flop, custom sandals, slippers. No matter the color or shape, just need the details of design. We can produce according to your design, or if you don’t have your own design,We can help you make design to help you build your own product on your thougt,too.

    Wholesale Sandals From China

    ReplyDelete
  41. NEONICE sandals factory specializes in sandals production technology experts, mainly produces PVC, EVA, TPR, PU, rubber and plastic materials such as sandals and flop flops. Starting business since 2008, 10 million pairs of sandals producing and exporting every year. Which can ensure the normal delivery period of each customer. Guarantee quality.

    Our sandals manufacturer focus on custom flip flop, custom sandals, slippers. No matter the color or shape, just need the details of design. We can produce according to your design, or if you don’t have your own design,We can help you make design to help you build your own product on your thougt,too.

    Wholesale Sandals From China

    ReplyDelete
  42. NEONICE sandals factory specializes in sandals production technology experts, mainly produces PVC, EVA, TPR, PU, rubber and plastic materials such as sandals and flop flops. Starting business since 2008, 10 million pairs of sandals producing and exporting every year. Which can ensure the normal delivery period of each customer. Guarantee quality.

    Our sandals manufacturer focus on custom flip flop, custom sandals, slippers. No matter the color or shape, just need the details of design. We can produce according to your design, or if you don’t have your own design,We can help you make design to help you build your own product on your thougt,too.

    Wholesale Sandals From China

    ReplyDelete
  43. Are You Looking for Financial Freedom?
    Me Too!


    You probably have dreams of a big mansion, and huge ambitions to become successful. You’re willing to do whatever it takes.
    But you’re not oblivious to reality either. You probably know that most of us will never become millionaires.
    There’s so much information out there, you either listen to the wrong people or you get paralyzed by overthinking.
    Before you know it, years would have passed, and nothing would have changed in your life.
    Did I get it right?

    My Millionaire Mission





    ReplyDelete

  44. Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts.

    Learning graphic Design Course from the experts helps students to understand products standards tips and tricks which will make them more productive at work, we teach industry standards software such as adobe photoshop cc2020, adobe illustrator cc 2020, adobe InDesign 2020..



    Graphic Design Training Institute


    ReplyDelete