SCREEN SHOT FOR ACCOUNT
LATITUDE,LONGITUDE,ACCURACY
Create
same as like this for Contacts and leads.
Add
the fileds to your pagelayouts.
That's it for the Address field on leads! Now the geocode
information associated with Address is visible on lead records. Repeat the same
steps to add geocode information to the page layouts for accounts and contacts.
Accounts have two address fields, and there are three associated geocode information
fields (latitude, longitude, and accuracy rating) for each address.
GEOCODE
FIELDS:
Geocode information identifies a location using a
latitude, a longitude, and an accuracy rating. Geocode fields are available for
standard addresses on accounts, contacts, and leads in Salesforce. Geocode
fields are not visible on records, but they can be viewed using the Salesforce
API.
Geocodes are added to records using Data.com technology.
However, a Data.com license is not required to use this feature
1.)Setup>> enter
Clean Rules in the Quick Find box >> select Clean Rules.
2.)Edit a geocode
clean rule. There are four geocode clean rules available.
3.)Review your clean rule settings.
4.)Save the rule.
5.)Activate the rule.
6.)If Clean all records when this rule is activated or
saved is selected, geocodes are automatically added to all existing records.
New records automatically get geocodes when they’re saved. Existing geocode
values are overwritten.
7.)Repeat this process for the other geocode clean rules.
8.)In Salesforce Classic, if you want to be able to check
the clean status of the geocode clean rules, add the Clean This Record with
Data.com related list to the page layout for accounts, contacts, and leads. (In
Lightning Experience, this step isn’t necessary!)
9.)Fill the address in account,contacts,lead and press
clean in related list of Record Detail Page.
10.) To Integrate the map in to your developer org.
create
visualforce page like this
<apex:page
controller="Mapintegrations" showHeader="true" sidebar="false">
<style
type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { width:1000px;height:600px; }
</style>
<body>
<div id="map-canvas"/>
<script
src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
var map;
function initialize() {
var mapOptions = {
center: new
google.maps.LatLng(19.337962, 76.684570),
zoom: 15
};
map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
plotlocation();
plotlocationcon();
plotlocationlead();
}
function plotlocation() {
Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.Mapintegrations.findAll}',
function(result, event){
if (event.status) {
for (var i=0;
i<result.length; i++) {
var id = result[i].Id;
var name =
result[i].Name;
var lat =
result[i].Billing_Address_Latitude__c;
var lng =
result[i].Billing_Address_Longitude__c;
var lati
=result[i].Shipping_Address_Latitude__c;
var lngi
=result[i].Shipping_Address_Latitude__c;
addMarker(id, name,
lat, lng,lati,lngi);
}
} else {
alert(event.message);
}
},
{escape: true}
);
}
function plotlocationcon() {
Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.Mapintegrations.findcon}',
function(result, event){
if (event.status) {
for (var i=0;
i<result.length; i++) {
var conid =
result[i].Id;
var conname =
result[i].Name;
var conlat =
result[i].Address_Latitude__c;
var conlng =
result[i].Address_Longitude__c;
addMarker(conid, conname, conlat,
conlng);
}
} else {
alert(event.message);
}
},
{escape: true}
);
}
function plotlocationlead() {
Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.Mapintegrations.findlead}',
function(result, event){
if (event.status) {
for (var i=0;
i<result.length; i++) {
var leadid = result[i].Id;
var leadname =
result[i].Name;
var leadlat =
result[i].Address_Latitude__c;
var leadlng =
result[i].Address_Longitude__c;
addMarker(leadid, leadname, leadlat,
leadlng);
}
} else {
alert(event.message);
}
},
{escape: true}
);
}
function addMarker(id,name,lat,lng,lati,lngi,conid,conname,conlat,conlng,leadlat,leadlng)
{
var marker = new google.maps.Marker({
position: new
google.maps.LatLng(lat,lng,lati,lngi,conlat, conlng,leadlat, leadlng),
map: map,
title: name
});
google.maps.event.addListener(marker,
'click', function(event) {
window.top.location = '/' + id;
});
}
google.maps.event.addDomListener(window,
'load', initialize);
</script>
</body>
</apex:page>
CLASS
FOR MAP INTEGRATION AND PLOTTING:
global
with sharing class Mapintegrations {
@RemoteAction
global static List<Account> findAll()
{
return [SELECT
Id,Name,Billing_Address_Latitude__c, Billing_Address_Longitude__c,Billing_Address_Accuracy__c
FROM Account];
}
@RemoteAction
global static List<Contact> findcon()
{
return [select
Id,Name,Address_Latitude__c,Address_Longitude__c,Address_Accuracy__c FROM
Contact];
}
@RemoteAction
global static List<Lead> findlead() {
return [select
Id,Name,Address_Latitude__c,Address_Longitude__c,Address_Accuracy__c FROM
Lead];
}}
<apex:inputField value="{!test.Dollar_Value__c}" required="true" label="" styleClass="dollor"/>