This means you don't have any visualforce pages using the Account controller. Once you've created a visualforce page, it will appear as an option in the layout.
Just adding the standardController attribute related to Account is enough
<apex:page standardController="Account">
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page: mynewaccountpage
<!-- End Default Content REMOVE THIS -->
</apex:page>
If you don't use standardController Salesforce would not know you want to make the page available to this object. If you need to add some more functionality add the attribute extension with your controller:
<apex:page standardController="Account" extensions="MyController">
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page: mynewaccountpage
<!-- End Default Content REMOVE THIS -->
</apex:page>
@Agustina Garcia https://sfdchack.blogspot.in/2012/10/adding-multiple-different-colour-marker.html i have created a google maps VF page by doing R&D from above link.Then it was working fine.and "visualforce pages" was also visible in editor.Until i presses this one as shown in the below image.from that time visualforce pages are not visible in editor in my Org.
Why don't you try to creaste a sample page with standardController = "Account" ? Then try to check if this sample page is visible in your account editor. If not, please, share your code and a screenshot.
Per above image, what you have done is to remove a related list section?
@Agustina Garcia This is my page and class code.Actually I want to display all accounts Locations on map.help me out with this ---------------------------------------------------------visualforce page ------------------------------------------------------------------------------------------------------------- <apex:page Controller="AccountList" sidebar="false"> <apex:includeScript value="https://maps.googleapis.com/maps/api/js?sensor=false"/> <apex:includeScript value="{!URLFOR($Resource.jQuery_BlogForce9_162, 'js/jquery-1.6.2.min.js')}"/> <apex:includeScript value="{!URLFOR($Resource.jQuery_BlogForce9_162, 'js/jquery-ui-1.8.16.custom.min.js')}"/> <apex:includeScript value="{!URLFOR($Resource.jqPlugin, '/jquery.blockUI.js')}"/> <apex:stylesheet value="{!URLFOR($Resource.jQuery_BlogForce9_162, 'css/ui-lightness/jquery-ui-1.8.16.custom.css')}"/>
public with sharing class AccountList { public list<Account> objAccounts {get;set;} public AccountList(){ try{ objAccounts = new list<Account>(); objAccounts.addAll([SELECT Name,BillingStreet,BillingCity,BillingPostalCode, BillingCountry FROM Account Where BillingCountry <> null limit 20]); }catch(Exception ex){ ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error:' +ex.getMessage())); } } }
Do you want to show in a visualforce page all Account locations? If so, why do you want to insert this vf page inside an account record? It does not make too much sense for me ... Or do you expect to show a map with an specific account location and then insert in the Account record page?
If you want create a visualforce page with all Account locations, then your code is ok (we could enhance the class but it works) . Then you can create a custom tab for your page: Setup | App Setup | Create | Tabs and go to Visualforce Tabs section. There you would be able to select your page.
var geocoder = new google.maps.Geocoder(); var address = "{!Account.BillingStreet}, " + "{!Account.BillingCity}, " + "{!Account.BillingPostalCode}, " + "{!Account.BillingCountry}";
var infowindow = new google.maps.InfoWindow({ content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.BillingPostalCode}<br>{!Account.BillingCountry}" });
geocoder.geocode( { address: address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK && results.length) { if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
//create map map = new google.maps.Map(document.getElementById("map"), myOptions);
} else { $('#map').css({'height' : '15px'}); $('#map').html("Oops! {!Account.Name}'s billing address could not be found, please make sure the address is correct."); resizeIframe(); } });
function resizeIframe() { var me = window.name; if (me) { var iframes = parent.document.getElementsByName(me); if (iframes && iframes.length == 1) { height = document.body.offsetHeight; iframes[0].style.height = height + "px"; } } }
}); </script>
</body> </apex:page> Now My requirement is to show Vf page in a tab. I Have created a custome tab and inserted the above created vf page.but it is showing Oops! billing address could not be found, please make sure the address is correct.". But when i insert this page in particular Account.Its working fine. ->So i want a tab with map including all accounts location.
My advice is to first of all remove all references to BillingAddress in your vf page and check if the page shows something without it. Then try to use directly the API name BillingAddress and check if it works now.
I was completly wrong, you need to access to the compound fields via its elements. So you were right.
I have been taking a look at your code and I found a comple of things, even I was not able to make it work, but mybe my findings can help you.
1. The Oops! billing address could not be found, please make sure the address is correct.". message comes from your code. That is because the address is not fine ( I guess ) but there is a space between Opps and billing address. There, we should find the Account Name. As you only have a custom Tab and the map is not related to a single Account, then, it is logic it does not work. 2. I have added to the url, the id of an Account and be sure that this account has BillingAddress field populated
Hi Augustina i have done it by diffrient way I have used page component and visual force page with controller and in the controller I have written this query and it's working fine .thank you for your help . AccList = [SELECT id,name,BillingStreet,BillingCity,BillingState,BillingCountry,BillingPostalCode FROM Account order by CreatedDate DESC limit 5];
AccList = [SELECT id,name,BillingStreet,BillingCity,BillingState,BillingCountry,BillingPostalCode FROM Account order by CreatedDate DESC limit 13];
Actually iam using the custome controller for the page.
https://sfdchack.blogspot.in/2012/10/adding-multiple-different-colour-marker.html
i have created a google maps VF page by doing R&D from above link.Then it was working fine.and "visualforce pages" was also visible in editor.Until i presses this one as shown in the below image.from that time visualforce pages are not visible in editor in my Org.
Per above image, what you have done is to remove a related list section?
---------------------------------------------------------visualforce page -------------------------------------------------------------------------------------------------------------
<apex:page Controller="AccountList" sidebar="false">
<apex:includeScript value="https://maps.googleapis.com/maps/api/js?sensor=false"/>
<apex:includeScript value="{!URLFOR($Resource.jQuery_BlogForce9_162, 'js/jquery-1.6.2.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jQuery_BlogForce9_162, 'js/jquery-ui-1.8.16.custom.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jqPlugin, '/jquery.blockUI.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.jQuery_BlogForce9_162, 'css/ui-lightness/jquery-ui-1.8.16.custom.css')}"/>
<script type="text/javascript"
src="https://maps.google.com/maps/api/js?sensor=false"></script>
<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:400px;
padding: 20px;
}
.roundCornerCss{
/* outer shadows (note the rgba is red, green, blue, alpha) */
-webkit-box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0px 1px 6px rgba(23, 69, 88, .5);
/* rounded corners */
-webkit-border-radius: 12px;
-moz-border-radius: 7px;
border-radius: 7px;
/* gradients */
background: -webkit-gradient(linear, left top, left bottom,
color-stop(0%, white), color-stop(15%, white), color-stop(100%, #D7E9F5));
background: -moz-linear-gradient(top, white 0%, white 55%, #D5E4F3 130%);
}
</style>
<script type="text/javascript">
var geocoder;
var map;
var infowindow = new google.maps.InfoWindow();
var places = [];
var title_content = new Array();
var popup_content = new Array();
var address = new Array();
var address_position = 0;
var timeout = 600;
function initialize(){
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(29.01, 77.38);
var myOptions = {
zoom: 2,
center: latlng,
mapTypeId: 'roadmap'
}
<apex:repeat value="{!objAccounts}" var="loc" id="addressesId">
title_content.push("Name: "+"{!loc.Name}"+" \nClick for more Detail");
address.push("{!loc.BillingStreet}, {!loc.BillingCity},
+"{!loc.BillingPostalCode},{!loc.BillingCountry}");
popup_content.push("<b>Account Name: {!loc.Name}
+"<br/>Street: {!loc.BillingStreet}"
+"<br/>City: {!loc.BillingCity}<br/>Postal Code: {!loc.BillingPostalCode}"+
+"<br/>Country: {!loc.BillingCountry }</b>");
</apex:repeat>
map = new google.maps.Map(document.getElementById("map"), myOptions);
addMarker(address_position);
}
function addMarker(position){
geocoder.geocode({'address': address[position]}, function(results, status){
if (status == google.maps.GeocoderStatus.OK) {
places[position] = results[0].geometry.location;
var marker = new google.maps.Marker({
position: places[position],
title:title_content[position],
icon: getMapIconUrl(position+1),
map: map
});
google.maps.event.addListener(marker, 'click', function() {
if (!infowindow) {
infowindow = new google.maps.InfoWindow();
}
infowindow.setContent(popup_content[position]);
infowindow.open(map, marker);
});
}
else{
if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT){
setTimeout(function() { addMarker(position); }, (timeout * 3));
}
}
address_position++;
if (address_position < address.length){
setTimeout(function() { addMarker(address_position); }, (timeout));
}
});
}
/*
@Description: To Put diffren color image on Google Map
@Param: Marker Number to Add on map.
*/
function getMapIconUrl(markerNumber){
if(markerNumber > 21){
markerNumber = markerNumber%20;
}
var mapIconUrl = "{!URLFOR($Resource.GoogleMarkers, 'GoogleMark/1.png')}";
var newIcon = markerNumber+'.png';
mapIconUrl = mapIconUrl.replace('1.png',newIcon);
return mapIconUrl;
}
</script>
<apex:pageMessages />
<div id="map" class="roundCornerCss"></div>
<script>
initialize();
</script>
</apex:page>
---------------------------------------------------------Apex class-------------------------------------------------------------------------------------------------------------
public with sharing class AccountList {
public list<Account> objAccounts {get;set;}
public AccountList(){
try{
objAccounts = new list<Account>();
objAccounts.addAll([SELECT Name,BillingStreet,BillingCity,BillingPostalCode,
BillingCountry FROM Account
Where BillingCountry <> null limit 20]);
}catch(Exception ex){
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error:'
+ex.getMessage()));
}
}
}
Do you want to show in a visualforce page all Account locations? If so, why do you want to insert this vf page inside an account record? It does not make too much sense for me ... Or do you expect to show a map with an specific account location and then insert in the Account record page?
If you want create a visualforce page with all Account locations, then your code is ok (we could enhance the class but it works) . Then you can create a custom tab for your page: Setup | App Setup | Create | Tabs and go to Visualforce Tabs section. There you would be able to select your page.
<apex:page standardController="Account">
<head>
<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:250px;
background:transparent;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var myOptions = {
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false
}
var map;
var marker;
var geocoder = new google.maps.Geocoder();
var address = "{!Account.BillingStreet}, " + "{!Account.BillingCity}, " + "{!Account.BillingPostalCode}, " + "{!Account.BillingCountry}";
var infowindow = new google.maps.InfoWindow({
content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.BillingPostalCode}<br>{!Account.BillingCountry}"
});
geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);
//center map
map.setCenter(results[0].geometry.location);
//create marker
marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: "{!Account.Name}"
});
//add listeners
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
});
}
} else {
$('#map').css({'height' : '15px'});
$('#map').html("Oops! {!Account.Name}'s billing address could not be found, please make sure the address is correct.");
resizeIframe();
}
});
function resizeIframe() {
var me = window.name;
if (me) {
var iframes = parent.document.getElementsByName(me);
if (iframes && iframes.length == 1) {
height = document.body.offsetHeight;
iframes[0].style.height = height + "px";
}
}
}
});
</script>
</body>
</apex:page>
Now My requirement is to show Vf page in a tab.
I Have created a custome tab and inserted the above created vf page.but it is showing Oops! billing address could not be found, please make sure the address is correct.".
But when i insert this page in particular Account.Its working fine.
->So i want a tab with map including all accounts location.
or that is the theory.
My advice is to first of all remove all references to BillingAddress in your vf page and check if the page shows something without it. Then try to use directly the API name BillingAddress and check if it works now.
I was completly wrong, you need to access to the compound fields via its elements. So you were right.
I have been taking a look at your code and I found a comple of things, even I was not able to make it work, but mybe my findings can help you.
1. The Oops! billing address could not be found, please make sure the address is correct.". message comes from your code. That is because the address is not fine ( I guess ) but there is a space between Opps and billing address. There, we should find the Account Name. As you only have a custom Tab and the map is not related to a single Account, then, it is logic it does not work.
2. I have added to the url, the id of an Account and be sure that this account has BillingAddress field populated
https://c.eu2.visual.force.com/apex/<yourvisualforcepagename>?id=001b000003XlxDN
3. Add a couple of alerts in your code:
As you can see above I'm trying to show the address.
First alert shows me this, so the information is properly retrieved.
But second alert shows me this, so not sure
Not sure if this helps you to find the solution. I hope so.
Agustina
i have done it by diffrient way I have used page component and visual force page with controller and in the controller I have written this query and it's working fine .thank you for your help .
AccList = [SELECT id,name,BillingStreet,BillingCity,BillingState,BillingCountry,BillingPostalCode FROM Account order by CreatedDate DESC limit 5];
AccList = [SELECT id,name,BillingStreet,BillingCity,BillingState,BillingCountry,BillingPostalCode FROM Account order by CreatedDate DESC limit 13];
string str3;
for(Account ac:AccList){
string str = '\'+ac.BillingStreet \'';
str3 = ac.BillingStreet;
String str2 = '\''+ac.BillingStreet+','+ac.BillingCity+','+ac.BillingState+'\'';
system.debug('the value is'+str2);
listOfAddresses.add(str2);