Simple Button to open Google maps to the address

I swear I had examples of this, just a simple button to open the address I'm looking at in Sage CRM in say google maps.  I thought there was a community post about this as well but I'm striking out everywhere.  Anyone have an example of this or link to where this might be in the community?

  • 0

    My example uses a custom entity to lookup a post code. Place this code in the CustomContent of a screen which has a post code on and replace _Datasites__postcode with the field name of your postcode e.g. _Dataaddr_postcode. This will place three buttons on for Google, Streetmap and Bing Maps. Hopefully this will point you in the right direction : 

    <input type="button" value="Google Map" name=Map1 onclick="LaunchMap(1,_Datasites__postcode)"/>
    <input type="button" value="Streetmap" name=Map2 onclick="LaunchMap(2,_Datasites__postcode)"/>
    <input type="button" value="Bing Maps" name=Map3 onclick="LaunchMap(3,_Datasites__postcode)"/>
    function LaunchMap(mapindex, fieldobj) {
    
    
        var sitepostcode = fieldobj.outerText;
    
        var URL = '';
    
    
        if (sitepostcode != '') {
    
    
            switch (mapindex) {
    
                case 1:// google maps
    
                    URL += "http://maps.google.co.uk/maps?f=d&hl=en";
    
                    URL += "&saddr=RH13+5QH";
    
                    URL += "&daddr=" + sitepostcode.replace(/ /, "+");
    
                    URL += "&btnG=Search";
    
                    break;
    
                case 2: // streetmap
    
                    URL += "http://www.streetmap.co.uk/streetmap.dll?postcode2map?";
    
                    URL += sitepostcode.replace(/ /, "+");
    
                    break;
    
                case 3: // bing maps
    
                    URL += "https://www.bing.com/maps?rtp=adr.RH13+5QH~adr.";
    
                    URL += sitepostcode.replace(/ /, "+");
    
                    break;
    
                default:
    
                    window.alert('Incorrect Map index specified. Please speak to IT');
    
            }
    
    
            var win = window.open(URL, 'Locations', 'status=yes,toolbar=no, menubar=no, location=no,resizable=yes, scrollbars=yes');
    
            win.focus();
    
        }
    
        else {
    
            window.alert('No postcode to perform search with. Please ensure address has a postcode');
    
        }
    
    
    }

  • 0 in reply to Elementus

    Thank you fine sir!!!  This will at least get me going have a great rest of your week!