I want to display all of my accounts and leads on a google map in a visualforce page. Problem is that I have the Sales Cloud professorial edition which allows me to write vf pages but not classes. Can I achieve the above without a custom controller?

  • Not in the wildest of my dreams but using sforce.connection you can query and pull all object info and using somekind of googles plugins Not sure where else you might get struck without using a controller class !!! – Rao Nov 22 '12 at 21:27
  • It seems it is worth saying that I do have the API enabled on my Professional edition. – Dedo Nov 23 '12 at 7:20


If you have API enabled that's a really good news. Ability to send database queries & updates will be a huge benefit for you. Using AJAX toolkit:

  1. you can decide which accounts to display (if listview filters won't be enough)
  2. you'll get the data in JSON format so no need for listview at all; without traversing the HTML table and collecting data you'll find the my answer on SO a bit better suited
  3. Plus you'll be able to update the records back with the lat/long coordinates. Cached data, no need to geocode, faster map loading.

Check the advanced examples in the toolkit docs for query,retrieve/search (if you plan building a form like I did in my SO answer) and update calls.

(Or a bit more advanced - if you want to display "recently viewed Accounts" this answer about REST API is awesome: https://salesforce.stackexchange.com/a/4244/799).


This is going to be painful...

@rao your comment wont work as it seems API access is paid extra in Professional Editions. See this topic on the boards and this idea.

First you'll need a way to display all these Accounts and Leads without querying for data... Do you have any ideas for this?

  • StandardSetController would be best but you can have only one on the page so it'd be Accounts or Leads. There's nice example in documentation how to display them. You won't even need the form I think, just pageBlockTable
  • failing that: you could experiment with embedding two <apex:enhancedList>s on same page? Or <apex:listViews>
  • <apex:relatedList>, <apex:repeat> etc tags probably won't work as you'd need some kind of master record to which all other would be linked.


    <apex:enhancedList type="Account" height="300" rowsPerPage="10" id="AccountList" />
    <apex:enhancedList type="Lead" height="300" rowsPerPage="25"  id="LeadList" />

Then the actual Google Map mashup.

You'll need to fetch the data from the tables to JavaScript variables, geocode the addresses and display them (or do you already have latitude&longitude?). I wrote something like that and published it as StackOverflow answer to How do I integrate Salesforce with Google Maps?.

But as it was over 2 years ago and now the code is simply butt-ugly so I've recently upgraded it. Check the revision history of my answer and decide which version suits you more. If the rev. history is hard to read - you can always view the raw source of original answer.

(disclaimer: I think some bugs might lurk in the old one's geocoding routine, people reported problems with displaying the map: https://stackoverflow.com/questions/3566729/salesforce-com-visualforce-google-maps, https://stackoverflow.com/questions/9028682/google-map-integrated-with-salesforce-is-blank; I'd recommend salvaging what you can from the new version)

  • That is a detailed explanation!!!! I never knew professional editions limitations !!! – Rao Nov 23 '12 at 1:46
  • Thanks guys. I do have the API enabled on my Professional edition. Would that make my life easier? – Dedo Nov 23 '12 at 7:19
  • Updated, with API it'll be simpler :) @rao - that would be very stupid for SF Sales if they locked down options to write Apex but allowed API access (AJAX toolkit, REST, DataLoader etc) ;) You could just offload your business logic to some Java App that'd be fetching data... – eyescream Nov 23 '12 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.