Newer Version Available

This content describes an older version of this product. View Latest

Creating the Custom Controller

To build the mapping application, we first need to create the custom controller referenced by the Visualforce page that displays the map and corresponding list of accounts. The controller retrieves the user's accounts with a rating of 'Hot' and builds a string array of delimited accounts for use in the mapping JavaScript routine on the Visualforce page. It also defines a getter method for the Maps API key, which is required in order to use Google Maps in our page.

The following Apex class is the controller for the Visualforce page that maps the user's hot accounts: