Summary:

On one of our on-premise installs we had this behaviour with maps component.

We can change the map location but it saves an address which is  tens of kilometres on the south west of the address saved.

Solution:

When I view the HTML source of the maps page, I can see the script below. As you can see, a comma is being used as a decimal point. When the preferences are changed on the install, the problem keeps happening.

<script>
comp_name='CVCC1';
sInstallName='crm'
entity='Company'
companyMapped=true;
comp_xtmp_long=-6,42355728149249;
comp_xtmp_lat=53,2889949243503;
addressStr="La Maquina 50";
</script>

The problem was related to the locale settings on the server which uses commas (,) instead of decimal points (.) for the decimal separator. This was causing the maps component to malfunction. Unfortunately for jscript there’s no good way to detect the locale of the server or to detect where it is reading it from so to workaround the issue I’ve updated the code as below.

You can update the "MapsTab.asp" to add the highlighted lines below:

if (companyId) {
var company = CRM.CreateQueryObj("SELECT comp_xtmp_longlat.Long AS comp_xtmp_long, comp_xtmp_longlat.Lat AS comp_xtmp_lat FROM Company WHERE comp_companyid=" + companyId);
company.SelectSql();
comp_xtmp_long = company.FieldValue("comp_xtmp_long");
if(comp_xtmp_long !=null)
comp_xtmp_long = comp_xtmp_long.replace(',','.');
comp_xtmp_lat = company.FieldValue("comp_xtmp_lat");
if(comp_xtmp_lat !=null)
comp_xtmp_lat = comp_xtmp_lat.replace(',','.');
companyMapped = comp_xtmp_long+''!='undefined';
entity = "Company";

else if (leadId) {
var lead = CRM.CreateQueryObj("SELECT lead_xtmp_longlat.Long AS lead_xtmp_long, lead_xtmp_longlat.Lat AS lead_xtmp_lat FROM Lead WHERE lead_leadid=" + leadId);
lead.SelectSql();
comp_xtmp_long = lead.FieldValue("lead_xtmp_long");
if(comp_xtmp_long !=null)
comp_xtmp_long = comp_xtmp_long.replace(',','.');
comp_xtmp_lat = lead.FieldValue("lead_xtmp_lat");
if(comp_xtmp_lat !=null)
comp_xtmp_lat = comp_xtmp_lat.replace(',','.');
companyMapped = comp_xtmp_long+ '' !='undefined';
entity = "Lead";
}