Google Maps integration

Place the code in the on load event, change the address fields to your applicable fields, populate the country field if not defaulted with teh right country and then update the iframe source details. You make want to add a checkbox on the map tab to control when the below code is applied to the iframe as you do not want the map loading everytime you open up your record (slows down the loading of the record). Happy Mapping!!

var CRM_FORM_TYPE_CREATE = 1;

var CRM_FORM_TYPE_UPDATE = 2;

var LiveSearchURL = "";

 if(IsOnline())

{

                switch (crmForm.FormType)

                {

                                case CRM_FORM_TYPE_CREATE:

                                                // Point to the Microsoft Live Search home page when creating an account

                                                LiveSearchURL = "http://maps.google.com";  

                                                break;

                                 case CRM_FORM_TYPE_UPDATE:

                                               // Use Live search with this account’s name

                                                LiveSearchURL = http://maps.google.com/maps?q=;

                                                // Encode the account name and add it to the search string

                                                                LiveSearchURL += crmForm.all.address2_line1.DataValue;

                                                LiveSearchURL += " ";

                                                                LiveSearchURL += crmForm.all.address2_line2.DataValue;

                                                                LiveSearchURL += " ";

                                                                LiveSearchURL += crmForm.all.address2_city.DataValue;

                                                                LiveSearchURL += " ";

                                                                LiveSearchURL += crmForm.all.address2_country.DataValue;

                                                break;

                }

}

 

// Set the IFRAME’s URL

crmForm.all.IFRAME_MAP.src = LiveSearchURL;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s