Thursday, August 1, 2019

Maps Navigation in D365 FO/ AX 2012

      //MAPS Navigation in D365 FO , AX 2012     

       LogisticsPostalAddress postalAddress;
        const str comma = ',';
        const str newLine = '\n';

        str     address,;
        str mapUrl = 'https://www.bing.com/maps/default.aspx?where1=\%1'; 

        select firstonly postalAddress; //For testing Selected first record

        address = postalAddress.Street + comma +
                      postalAddress.City + comma +
                      postalAddress.State + comma +
                      postalAddress.ZipCode + comma +
                      postalAddress.CountryRegionId;
        address = strReplace(address, newline, comma);
        address = System.Web.HttpUtility::UrlEncode(address);

        Browser br = new Browser();
        br.navigate((strFmt(mapUrl, address)), true); //for Bing

        str     addressGoogle;
        str  mapUrlGoogle = 'http://maps.google.com?q=\%1';
        const str comma = ',';
        const str newLine = '\n';
         mapUrlGoogle = 'http://maps.google.com?q=\%1';
        addressGoogle = postalAddress.Street + comma +
                      postalAddress.City + comma +
                      postalAddress.State + comma +
                      postalAddress.ZipCode + comma +
                      postalAddress.CountryRegionId;
        addressGoogle = strReplace(addressGoogle, newline, comma);
        addressGoogle =  System.Web.HttpUtility::UrlEncode(addressGoogle);
        Browser brGoogle = new Browser();
        brGoogle.navigate((strFmt( mapUrlGoogle, addressGoogle)), true); for Google maps

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...