Salesforce Advance Developers -501 Notes

Page 27

• To bring an account record into the current context, you must add a query parameter to the page URL that specifes the ID of the record Redirecting to a Standard Object List Page:<apex:page action="{!URLFOR($Action.Account.List, $ObjectType.Account)}"/> List and describe syntax features of Visualforce Visualforce markup consists of Visualforce tags, HTML, JavaScript, or any other Web-enabled code embedded within a single <apex:page> tag.The markup defnes the user interface components that should be included on the page, and the way they should appear. Describe best practices for incorporating static resources, stylesheets, and other content into Visualforce pages To reference a stand-alone fle, use $Resource.<resource_name> as a merge feld, where <resource_name> is the name you specifed when you uploaded the resource. For example: <apex:image url="{!$Resource.TestImage}" width="50" height="50" /> To reference a fle in an archive, use the URLFOR function. Specify the static resource name that you provided when you uploaded the archive with the frst parameter, and the path to the desired fle within the archive with the second. For example: <apex:image url="{!URLFOR($Resource.TestZip, 'images/Bluehills.jpg')}" width="50" height="50" / > Through a custom controller, you can dynamically refer to the contents of a static resource using the <apex:variable> tag. First, create the custom controller: global class MyController { public String getImageName() { return 'Picture.gif';//this is the name of the image } } Then, refer to the getImageName method in your <apex:variable> tag: <apex:page renderAs="pdf" controller="MyController"> <apex:variable var="imageVar" value="{!imageName}"/> <apex:image url="{!URLFOR($Resource.myZipFile, imageVar)}"/> </apex:page> If the name of the image changes in the zip fle, you can just change the returned value in getImageName. Using Salesforce.com Styles You can specify the tab style that should be used to style a component by associating a page with a standard controller or by setting the tabStyle attribute on the <apex:page> or <apex:pageBlock> tags: • When you use a standard controller with a Visualforce page, your new page takes on the style of the associated object's standard tab in Salesforce.com. It also allows you to access the methods and records associated with the associated object. • When you use a custom controller, the tabStyle attribute of an <apex:page> tag allows you to mimic the look and feel of the associated Salesforce.com page. If you only want portions of the page to be similar to a Salesforce.com page, you can use the tabStyle attribute on the <apex:pageBlock> tag. Salesforce.com uses different stylesheets (.css fles) throughout the application to ensure that every tab conforms to the Salesforce.com look and feel.When you specify true for the header attribute of the <apex:page> tag (or leave it blank, as


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.