Visualforce Flashcards
After a Visualforce page redirect, the next page doesn’t show expected object information. What is the reason?
After a redirect, the controller clears the context state.
What is the limit on how many records a Visualforce iteration component can iterate over?
1,000 records. This is increased to 10,000 records in read only mode.
Which Visualforce component renders a ul or ol element with li items comprising the rows?
<apex:dataList>
</apex:dataList>
When is a view state deleted? When is it maintained?
It is deleted if a new get request is made by the user. If the user is redirected to a page that uses the same controller and the same or a proper subset of controller extensions, a postback request is made. When a postback request is made, the viewstate is maintained.
When returning a PageReference, named myPage, what must you first do to redirect to the new page?
Set the redirect attribute to true using myPage.setRedirect(true).
True or false: A Visualforce page can be launched as a quick action.
True.
Which Visualforce components are required for you to send actions through forms?
<apex:commandButton />
or <apex:commandLink/>
True or false: if you provide a constructor, you can still access the default, no-argument constructor.
False.
What is the standard signature for for an action method?
Is public, returns a PageReference, and contains no arguments.
What is the syntax to return a reference to the current page?
ApexPages.currentPage();
True or false: if you don’t provide a constructor, Apex provides a default, no-argument constructor.
True.
A Visualforce page uses the standard list controller with recordSetVar=”{!contacts}”. What is the syntax to create an <apex:pageBlockTable> to loop through the records?</apex:pageBlockTable>
<apex:pageBlockTable> value="{!contacts}" var="ct"></apex:pageBlockTable>
Which component adds the complete record details to a Visualforce page?
<apex:detail></apex:detail>
What is the syntax to include a Javascript file saved as a static resource named “jQuery”?
<apex:includescript value="{! $Resource.jQuery }"/>
How do you set a Visualforce page to read only mode?
Set the readOnly attribute of the <apex:page>
tag to true.
What is the syntax to output a formatted version of a field named myField from an object named myObject?
<apex:outputField value="{! myObject.myField}" />
What happens if any fields or objects referenced in a SOQL SELECT query using WITH SECURITY_ENFORCED are inaccessible to the running user?
A System.QueryException is thrown.
Which Visualforce tag adds AJAX support to another component?
<apex:actionSupport>
True or false: DML methods can be used in getter methods.
False.
Which character is the formula language operator that concatenates strings?
The & character.
Which property sets the action on an <apex:commandButton></apex:commandButton> component?
action
Which three components are used to include static resources?
<apex:includeScript>
, <apex:stylesheet>
, and <apex:image>
.
True or false: a controller extension uses the extends keyword in its class definition.
False.
Which method adds a message (usually an error message) to a page?
ApexPages.addMessages(message);
True or false: Visualforce expressions are case sensitive.
False. Visualforce expressions are case-insensitive.
Which formula returns a relative URL for an action, s-control, Visualforce page, or a file in a static resource archive in a Visualforce page?
URLFOR()
Which property provided by the standard list controller provides a menu of available filters for the object?
listViewOptions
What is a PageReference?
A reference to an instantiation of a page. Among other attributes, it consists of a URL and a set of query parameter names and values.
Which global variable is used for referencing static resources?
$Resource
What is the global merge field for referencing a standard Salesforce actions, such as editing/creating/deleting objects?
$Action
True or false: you cannot create a custom controller constructor that includes parameters.
True.
How do you add a standard controller to an Apex page?
standardController=”Account”
What is the order of method overrides in controller extensions?
Methods from whichever extension class is defined in the leftmost position of the “extensions” property will take precedence.
How do you add a custom controller to a page?
By referencing the name of the controller in the <apex:page>
component’s controller attribute.
Where are permissions for an Apex class checked?
Only at the top level.
True or false: custom controllers run in user mode.
False. Custom controllers run in system mode.
If a class is used as the entry point to an Apex transaction and with sharing/without sharing or not specified, what is the default?
without sharing