Visualforce 38% Flashcards

1
Q

What is a Visualforce Controller?

A

A set of instructions that specifies:

  1. User interaction with VF markup, such as clicking a button or link.
  2. Access to data that should be displayed in a page.
  3. Modifications to component behavior.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a standard controller?

A

A standard controller consist of the same functionality and logic that is used for a standard Salesforce page, I.E. standard Account controller.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What happens if you use the standard controller on a page and the user doesn’t have access to the object?

A

The page will display a insufficient privileges error.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a custom controller?

A

A class written in Apex that implements the logic for the page without using a standard controller.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

True/False: custom controllers execute in system mode.

A

True.
Are without sharing as standard and so ignores any permissions based on the users profile.
It is possible to change this by using the with sharing keyword in the controller extension.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True/False: standard controller execute in system mode.

A

False. Standard controllers execute in user mode (with sharing).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a controller extension?

A

A controller extension uses all the functionality in a standard controller. The controller extension expands or modifies that functionality by adding new capabilities or replacing standard capabilities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why would you choose a controller extension over a custom controller?

A

With an extension you do not have to recreate everything that a standard controller does to tweak or extend its operation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are custom components?

A

A reusable component that can be embedded in more than one Visualforce page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why would you choose to create a custom component over page templates?

A

Components provide more power and flexibility because:
1. You can define attributes that can be passed in to each components, which can change the way the markup is displayed on the final page.
2. Components are displayed in the reference dialog alongside standard component descriptions.
Note, Templates are defined as pages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In which 4 ways can you integrate Visualforce pages into your Force.com application.

A
  1. Custom tab
  2. Override standard tab
  3. Override standard buttons or links
  4. Embedded in a detail page layout
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are global variables?

A

Global variables can be used in Visualforce without a controller and are referenced by $. I.E. $User represents the current user record.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you access fields from a record that are not globally available?

A

Associate the page with a controller.

Controllers provide pages with the data and business logic that make your application run.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are action methods?

A

Action methods perform logic or navigation when a page event occurs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How are action methods called from page markup?

A

By using the ! notation in the action parameter of one of the action tags: commandButton, actionPoller, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the action parameter in apex:actionFunction do?

A

defines a new JavaScript function that calls an action.

17
Q

What does the action parameter in apex:page do?

A

Calls an action when the page is loaded.

18
Q

What are getter methods?

A

Getter methods return values from a controller.

Note, Every value calculated by a controller must have a corresponding getter method.

19
Q

What are static resources?

A

Static resources allow you to upload content that can be referenced in a Visualforce page, incl. archives such as zip files.

20
Q

Why would you choose static resources over documents.

A
  1. you can package related files
  2. you can reference static resources by name in page markup by using the $Resource global variable instead of hardcoding document IDs.
21
Q

Order the following to get the lifecycle of a Visualforce page.

  1. Metadata repository
  2. Page request
  3. Application server (page renderer)
  4. HTML result
  5. Application server
  6. Compiled page definition
A
  1. Page request
  2. Application server
  3. Metadata repository
  4. Compiled page definition
  5. Application server (page renderer)
  6. HTML result
22
Q

How do you test Visualforce controllers?

A

When writing unit tests for controller extensions and custom controller classes, you can set query parameters that can then be used in the tests.

23
Q

What is the difference between the messaging options in VF?
1.
2.

A
  1. apex:pageMessage is used to display a single custom message using the Salesforce formatting. You can specify the severity (which will control the display of the message box) and the strength (which will control the size of the box).
  2. apex:pageMessages is used to display all of the messages on a page. It will display Salesforce generated messages as well as custom messages added to the ApexPages class.
24
Q

What is the difference between the messaging options in VF?
1.
2.

A
  1. apex:message is used to display an error on only a very specific field. It is used to allow the developer to place field specific errors in a specific location.
  2. apex:messages is similar to apex:message, but it displays all of the errors. These errors are displayed as a list with no styling.