Newer Version Available
Try It Out: Add the Candidate Map to Position Page Layouts
Adding Visualforce pages to page layouts is as simple as adding fields or sections to page layouts. And once we add the CandidateMap Visualforce page to our position page layouts, the map will automatically plot the locations of the candidates who apply to each position. It'll work like magic!
We have two page layouts for the Position object and we'll want the map to appear on both. Let's start by adding the page to the original position page layout (Position Layout).
- From Setup, click .
- Click Position.
- In the Page Layouts related list, click Edit next to Position Layout.
- In the palette, select the Fields category.
- Drag the Section user interface element from the palette to just below the Description section on the page layout. The Layout Properties popup window appears.
- In the Section Name text box, enter Candidate Map.
- In the Display Section On Header area, select both the Detail Page and Edit Page checkboxes.
- In the Layout drop-down list, choose 1-Column.
- Click Ok.
- Select the Visualforce Pages category on the palette.
- Drag the CandidateMap user interface element from the palette to the Candidate Map section on the page layout.
The Candidate Map JavaScript generates a map that is 400 pixels high and spans the width of the screen. This is just large enough to be useful without consuming too much room on the screen. The default properties of the Visualforce page user interface element need to be adjusted to accommodate the map. Otherwise, there might be odd spacing around the map and distracting scrollbars.
Let's fix the Visualforce page user interface element properties to accommodate the size of the generated map, as well as the text we added to the top of the CandidateMap Visualforce page. (In case you don't remember, the text is “This map shows the locations of candidates who have applied for the <b>{!Position__c.Name}</b> position.”)
- Double-click the CandidateMap element to access its properties.
- Set the width to 100%.
- Set the height to 405.
The height is always in pixels, while the width can be specified either in pixels or as a percentage. Setting the height to 405 pixels allows 400 pixels for the map and five more pixels for the text. Perfect!
- Leave the Show scrollbars and Show label checkboxes deselected.
- Click OK to exit the user element properties.
- Click Save on the page layout.
Repeat all of the above steps for your other Position object page layout, the IT Position Layout.