The Infolog

A blog of Dynamics AX development tips and tricks

Skip to: Content | Sidebar | Footer

Google maps mini-map for customers

10 October, 2013 (14:04) | Dynamics AX, Uncategorized | By: Howard Webb

I wanted to move some of the google maps work I did in AX 2009. One of the bits I did originally was to produce a mini map in the customer screen:


I decided to fit better with 2012 I have moved it to a factbox. To create a fact box first you have to create a form design. In 2009 I used an Active X control (browsercpm) as it gave me more control over the browser window, however in AX2012 this is no longer present but there is an Active x control called “Microsoft Web Browser” which contained most of the same methods so I moved it to that. The form design is relatively simple, however I found out you need a datasource on a fact box as there is no method that is called between record switches unless you link a datasource. In the active of the data source I call my method. The form looks as follows:



And the custom methods are as follows:


void getGoogleMap()


CustTable custTableLocal;

Args args;



args = element.args();




if(args.record().TableId == tableNum(custTable))


custTableLocal = args.record();






void createURL(Addressing _address)



str mapUrl;



mapUrl = #MiniMapURLStart;

mapUrl += GoogleMapsHelper::formatAddress(_address);

mapUrl += #MiniMapURLEnd;






I also have a macro to containing the start and end of the URL:


#define.MiniMapURLStart(‘, United Kingdom&zoom=4&size=200×200&markers=color:red|’)





Along with a static method to format the address (I have used just the postcode due to issues with the data but this should format the full address correctly)


str formatAddress(Addressing _addr)


str ret;



ret = _addr;

ret = strReplace(ret, ‘ ‘, ‘+’);

ret = strReplace(ret, ‘\n’, ‘,’);

return ret;





And then to finish off the fact box a menu item and a form part.


finished result is:






Print Friendly, PDF & Email

Write a comment