Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

click on marker on google maps does not open window in dynamics 365 mobile app

Posted on by 15

Hi,

I built a model-driven app, in which i have a custom entity, which includes the address latitude and longitude, then i wanted to show this on an integrated google map (html web resource), and added a marker and the directions url to this marker so when the user clicks on the marker it would open google maps app (on the phone).

so my code is working and i am able to open google maps when i click on the marker if i am using a browser, but when i am using the Dynamics 365 mobile app, the click does not work!

so is this some kind of a bug or restriction? i hope someone would answer it.

so here is my java script code to check it.

function initialize() {
            'use strict';
            var map_canvas = document.getElementById('map_canvas');
            var map_options = {
                center: new google.maps.LatLng(33.3116075, 44.2158218),
                zoom: 6,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(map_canvas, map_options);
            var geocoder = new google.maps.Geocoder();
            var lat = window.parent.Xrm.Page.data.entity.attributes.get('drm1_addresslatitude').getValue();
            var lon = window.parent.Xrm.Page.data.entity.attributes.get('drm1_addresslongitude').getValue();
            var address = lat   ","   lon;
            geocoder.geocode({ 'address': address }, function (results, status) {
                if (status === google.maps.GeocoderStatus.OK) {
                    map.setCenter(results[0].geometry.location);
                    map.setZoom(14);
                    var marker = new google.maps.Marker({
                        map: map,
                        position: results[0].geometry.location,
                        url: "https://www.google.com/maps/dir/?api=1&destination="   results[0].geometry.location
                    });
                    /*var infoWin = new google.maps.InfoWindow();
                    google.maps.event.addListener(marker, 'click', function () {
                        infoWin.setContent(marker.url), infoWin.open(map, marker);
                    });*/
                    google.maps.event.addListener(marker, 'click', function () {
                        window.open(marker.url);
                    });
                } else {
                    //alert("Geocode was not successful for the following reason: "   status);
                }
            });
        }

        google.maps.event.addDomListener(window, 'load', initialize);

  • Suggested answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: click on marker on google maps does not open window in dynamics 365 mobile app

    Hello,

    Good question, I know the window.open method wasn't supported in the past on mobile (docs.microsoft.com/.../dn481572(v=crm.8) but I'm unsure if it is still the case today.

    Do you use the latest Dynamics 365 for Phones app version?

    Might be worth to open a Support Request to investigate this further: admin.powerplatform.microsoft.com/support

    Henry

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans