TECHLOGBOOKS

Friday, 15 March 2019

Salesforce Visual Force Interview Questions



1. What is visualforce controller in salesforce? What are they?

Visualforce controller is a set of instructions that specify what happens, when user interacts with components on visualforce pages, such buttons & links.

Here are the 3 types of controller 

1. Standard Controller, 
2. Custom controller & 
3. Controller extensions.


2. What is Standard Controller?
 Standard controller provides the salesforce in built functionality to interact with visualforce pages. You can use the standard actions like Save, Edit, Cancel & delete by using standard controllers.
Syntax : <apex:page standardController=”Account”>
3. What is Custom Controller?
Custom controller is an apex class that implements customized logic to visualfore pages.
We can override or create new functionality by using custom controllers.
Syntax: <apex:page controller=”Account” >
4. What is Standard List Controller?
Standard List Controller allows to display list of records in visualvalfoce page. Standard list controller provides additional pagination actions (First, Lat, Next & Previous) compared to standard controller.
Syntax: <apex:page standardController=”Account” recordSetVar=”accounts”>
defining this controller is similar to standard controller. But need to add one more attribute recordSetVar
5.  What are the tasks of standard controller?
Standard controllers provides ability to access and interact with structured business data contained in records displays in the proper user interface.
6. Can we use standardController & controller attributes at a time?
No, We cannot reference both attributes at a time.
See below syntax to under stand
<apex:page standardController=”ControllerName” extensions=”Class1, Class2,..”> Correct
<apex:page Controller=”MYControllerName” extensions=”Class1, Class2,..”>          Correct 
<apex:page standardController=”MYControllerName” Controller=”MyController”> Wrong
7. What is <apex:page> tag in visualforce markup?
This tag represents a single visualforce page. Every page must start & end with this tag.
<apex:page>
<!– Body of the page –>
</apex:page>
8. How can you create visualforce page in salesforce?
We can create visualforce pages in two ways.
1. From the setup menu go to Setup-> develop -> Build->Pages-> click on new button to create a page & enter name & code for visualforce page.
2. From the vsualforce editor. Enter /apex/pagename at the url & create new page in visualforce editor.
9. Which objects have associated standard controllers?
All standard and custom objects that can be accessed via the API have associated controllers
10. What is the purpose of controllers?
Controllers provide the data and actions that are available to a Visualforce page.
11. What are expressions used in pages to bind in controllers?
Using methods we can bind.
Getter: Will return value from controller to vf page
Setter: Will pass value from vf page to controller
Action: Will redirect to another page.

No comments:

Post a Comment