Tuesday 21 October 2014

Integrate Google Maps In Axapta 2012 R2 & Axapta 2012 R3


In Axapta system we can see customer / vendor address in bing.com maps.

In this customization I will show the same in google maps.




Before:

Accounts receivable/Common/Customers/All customers

Select any customer and edit

In Address tab we can see “Map”. When we click on that we can see customer address in bing maps.

After

Go to AOT-> Classes -> smmutility ->mapit (Method)

Copy and replace the below code in mapit method

/// <summary>
/// Opens Bing maps with the address.
/// </summary>
/// <param name="_address">
/// The address to map.
/// </param>
public static void mapIt(LogisticsPostalAddress _address)
{
   // #DEFINE.MapURL('http://maps.bing.com/default.aspx?where1=\%1')//Commented By Rahul
    #DEFINE.MapURL('https://www.google.com/maps/place/')//N-Code Added By Rahul Talasila
    #DEFINE.comma(',')
    #DEFINE.newLine('\n')

    str     address;
    ;
    if (_address)
    {
        address = _address.Street + #comma +
                  _address.City + #comma +
                  _address.State + #comma +
                  _address.ZipCode + #comma +
                  _address.CountryRegionId;

        // Replace the newline with comma
        address = strReplace(address, #newline, #comma);
        // URL encode
        address = System.Web.HttpUtility::UrlEncode(address);
        // Add the address to the URL
        infolog.urlLookup(strFmt(#MapURL+ address));//N-Code Changed By Rahul Talasila
    }
}


Go back to the customer->address and click on map.


 Below link helped me ..
http://querystring.org/google-maps-query-string-parameters/

@Rahul Talasila



No comments:

Post a Comment

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...