viernes, 29 de abril de 2011

Integrating Google Maps with CRM 4.0

Often companies that uses CRM 4.0 have need to visualize the locations of their customers to provide their services in a faster and more efficient so they need a reference map in the chips.
In this opportunity, I'll show you how to achieve this goal. In addition to this, we will create a button which allows me to show and hide the map as this occupies a considerable size.
First, we create an IFrame, which we will call map within the Account entity (can also be within the agency contact).



Now that we have the logic, we create the button in the account entity form and then copy the extract of Jscript code, for this we should modify your Sitemap in this way:



<Entity name="account">
<ToolBar ValidForCreate="0" ValidForUpdate="1">
<Button Icon="/_imgs/ico_16_4414.gif" JavaScript="var displ=crmForm.all.IFRAME_Map.style.display; if(displ=='none') crmForm.all.IFRAME_Map.style.display=''; else crmForm.all.IFRAME_Map.style.display='none';" PassParams="1" WinParams="" WinMode="0">
<Titles>
<Title LCID="1033" Text="Map" />
</Titles>
</Button>
<ToolBarSpacer />
</ToolBar>
</Entity>

Then, import the modified ISV and verify the results.
We must remove the check in order to not  restrict cross-frame scripting.
In the onload event of the form, we will get the values ​​that are relating to the name of the street, district, department and country and then concatenate in the following way. Significantly, for the registration of these fields I have not used the out of the box attributes, I worked with cutom lookups.
var url= "http://maps.google.com/maps?q=" + 
crmForm.all.jc_countryid.DataValue[0].name+ "," + 
crmForm.all.jc_stateid.DataValue[0].name + "," + 
crmForm.all.jc_districtid.DataValue[0].name + "," + 
crmForm.all.jc_street.DataValue;
crmForm.all.IFRAME_Map.src=url;

Now that the map is shown on the form, create a button which allows us to hide and / or display as we need. To accomplish this we must first consider the jscript that will allow this fucnionalidad.
var displ=crmForm.all.IFRAME_Map.style.display;
if(displ=='none') crmForm.all.IFRAME_Map.style.display='';
else crmForm.all.IFRAME_Map.style.display='none';
NOTE: The code above allows this functionality. The best practice is that the IFRAME is on a different section to hide the section instead of hiding the IFRAME because if we do this last, a gap is shown.

Spanish Post: Integrando Google Maps con CRM 4.0

No hay comentarios:

Publicar un comentario