Salesforce Learning Guide

Tuesday, 18 November 2014

What is <apex:SelectList> tag?

Apex:selectList is used to display list options that allows user to select one.more values at a time. See below Syntax to use apex:select list
<apex:selectList size=”1″ value=”{!filterId}”>
<apex:actionSupport event=”onchange” reRender=”oppList”/>
<apex:selectOptions value=”{!listviewoptions}”/>
</apex:selectList>

Know more about selectList
Below is the simple example to display list of records in visualforce page with list view & actions.
<apex:page standardController="Opportunity" recordSetVar="opportunities">
<apex:form >
<apex:pageBlock title="Displaying Opportunities">

<!-- Below <ape:selectList> tag is used to display listview -->

<apex:selectList size="1" value="{!filterId}">
<apex:actionSupport event="onchange" reRender="oppList"/>
<apex:selectOptions value="{!listviewoptions}"/>
</apex:selectList>

<!-- below code displays list of opportunnities -->

<apex:pageBlockTable value="{!opportunities}" var="opp" id="oppList">
<apex:column value="{!opp.Name}"/>
<apex:column value="{!opp.Account.Name}"/>
<apex:column value="{!opp.StageName}"/>
<apex:column value="{!opp.Type}"/>
<apex:column value="{!opp.ExpectedRevenue}"/>
</apex:pageBlockTable>

<!-- Using List action to display first, last, next & previous list -->

<apex:pageBlockButtons location="Bottom">
<apex:commandLink value="First" action="{!First}"/> &nbsp;
<apex:commandLink value="Next" action="{!Next}"/> &nbsp;
<apex:commandLink value="Previous" action="{!Previous}"/> &nbsp;
<apex:commandLink value="Last" action="{!Last}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>

Custom Controllers

What is custom controller? why we go for custom controllers?
Standard controllers provides only built in standard functionality to visualforce pages, such as Save, Edit, Cancel & Delete etc….

We cannot customize/develop our own functionality by using standard controllers. By using custom controllers we can write our own functionality or override existing functionality. Custom controller is an Apex Class developed by us. See the below syntax to define custom controller in visualforce page.
<apex:page Controller=”ControllerName”>

 What is controller extension? Controller extension is custom/additional behavior to standard controllers. Extension is an apex class. We can add number of extensions to visualforce page. See below syntax to define extension.

<apex:page Controller=”ControllerName” extensions=”Class1, Class2,..”>
We can use Stnadard controller/ Custom Controller and extensions at a time. But we cannot use Standard controller & Custom controller at a time. See below syntax to understand.

<apex:page standardController=”ControllerName” extensions=”Class1, Class2,..”> Correct

 <apex:page Controller=”MYControllerName” extensions=”Class1, Class2,..”>   Correct syntax

<apex:page standardController=”MYControllerName” Controller=”MyController”>  Wrong

 What we can do by using Custom Controllers?

– We can override existing functionality
– We can create new functionality.
– We can customize navigation.
– We can use HTTP callouts & Web Services
– We can have control for how information is accessed on the page.

Example to create custom controller:

In this example, I am creating a visualforce page to create & save multiple accounts at a time by using visualforce page & Custom controller.
Code for Visualforce page
<apex:page Controller="AddmultipleAccountsController">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!listAccount}" var="acc">
<apex:column headerValue="Account Name">
<apex:inputField value="{!acc.Name}"/>
</apex:column>
<apex:column headerValue="Account Number">
<apex:inputField value="{!acc.AccountNumber}"/>
</apex:column>
<apex:column headerValue="Account Type">
<apex:inputField value="{!acc.Type}"/>
</apex:column>
<apex:column headerValue="Industry">
<apex:inputField value="{!acc.Industry}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons >
<apex:commandButton value="Add one more account" action="{!addAccount}"/>
<apex:commandButton value="Save Accounts" action="{!saveAccount}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
 
Code for custom controller:
public class AddmultipleAccountsController {
Account account = new Account();
public list<Account> listAccount{ get; set; }
public AddmultipleAccountsController()
{
listAccount=new list<Account>();
listAccount.add(account);
}
Public void addAccount()
{
Account acc = new Account();
listAccount.add(acc);
}
public PageReference saveAccount() {
for(Integer i=0; i<listAccount.size(); i++)
{
insert listAccount;
}
return Page.Allaccountssaved;    // I am returning another vf page here.
}
}
Out put of above code: We can add multiple accounts at a time by using this page like below.
Here I am adding multiple rows and saving all records at time. We cannot achieve this by using standard controller. So i have written custom controller to achieve this.
Custom Controllers

Doing deployments when Active job is running

What is active job here? Any schedule job or apex job which is running in our salesforce system.
Generally in salesforce, we cannot perform deployments when active jobs are there & we are trying to deploy metadata related to active job in system. In this case we will remove jobs from our environment and continue with deployments.

But now, no need to stop schedule jobs in our environments to perform deployment when active jobs are running. In winter 15 release salesforce has provided a feature to continue with deployments when jobs are running in production.

Enabling the deployment of components with corresponding   active job.
To enable this go to setup -> deployment  settings -> “Allow deployments of components
when corresponding Apex jobs are pending or in progress” check this check box and save.
Deployment connection is renamed as deployment settings. See the below image for reference.
Deployment settings -  active jobs
Active jobs
I feel this is very useful option when are doing deployments. No need to stop jobs during deployments. But, this setting might cause apex jobs fail due to unsupported changes.

Quick Deploy –  Deployments in less time

What is quick deploy? By using this option you can deploy components to production with running test classes on your project release day. But you have to do successful validation before your release day.

Generally in salesforce deploying code to production very hard when your organization contain more test methods. If your organization contain more test methods, then your release will very long. But to avoid this, salesforce has provided quick deploy option. By using this option you can deploy code to production in very less time on your project release day.

This quick deployment option is only available for production environments. This not doesn’t applicable for non production organization & deployments not required for apex tests.

Salesforce has released this as a pilot program. If you want to enable this option for your org, then you you need to contact salesforce.com.

See below screen to under stand quick deployment option.
Quick Deployment
 If you did a successful validation of your package, then you can deploy that same deployment without running any test classes to your production. This option is valid for 4 days (96 hours) for successful validated deployment. Quick deployments are available only for validations with test runs that have passed  in the last four days.

actionFunction

What is <apex:actionFunction> tag? This tag defines  JavaScript functions to be called from JavaScript code.  By using this tag you can call controllers methods from java script code using an AJAX request .
This component must be a child of <apex:form> tag. And we cannot place this tag inside an iteration tag like <apex:pageBlockTable> & <apex:repet> now. Earlier we were able to do this.But with api version 23 we cannot place <apex:actionFunction> inside iteration tags.

Here I am providing an example, How to use <apex:actionFunction> tag is visualforce. I have created simple Lead form to enter lead details from custom page. Last name, Company & email are mandatory fields in below page. If any miss those required fields, I am displaying  alert by Javascript and i am calling method from java script to save the record. See below code to understand, how <apex:actionFunction> will work.
Visualforce page code:
<apex:page controller="InsertLeadController" showHeader="false">

<script type="text/javascript">
function validate()
    {
        if(document.getElementById('{!$Component.LF.LDB.Lname}').value == '' || document.getElementById('{!$Component.LF.LDB.comp}').value == '')
        {
            alert("LAST NMAE & Company are requird fields");
        }
        
        else
        {
            CallsubmitLead();
            alert("Account has been inserted");
        }
    }
    
 </script>
    
 <apex:form id="LF">
 <apex:actionFunction action="{!submitLead}" name="CallsubmitLead" reRender="LDB"/>  
 <apex:pageBlock title="Lead Form - Enter lead details" id="LDB"> 
  <table>
  <tr>
  <td><apex:outputText value="First Name"/></td>
  <td><apex:inputText value="{!firstName}"/></td>
  </tr>  
  <tr>
  <td><apex:outputText value="Last Name"/></td>
  <td><apex:inputText value="{!lastName}" id="Lname"/></td>
  </tr>  
  <tr>
  <td><apex:outputText value="Comapany"/></td>
  <td><apex:inputText value="{!comapany}" id="comp"/></td>
  </tr>  
  <tr>
  <td><apex:outputText value="Mobile"/></td>
  <td><apex:inputText value="{!mobile}"/></td>
  </tr>  
  <tr>
  <td><apex:outputText value="Lead Status"/></td>
  <td><apex:selectList value="{!statusOptions}">
  <apex:selectOptions value="{!items}"/>
  </apex:selectList></td>
  </tr>
  </table>  
  <apex:commandButton value="Save" onclick="validate();"/> 
 </apex:pageBlock>  
  </apex:form>
</apex:page>
Controller Code:
public class InsertLeadController {
public String statusOptions { get; set; }
public String comapany { get; set; }
public String mobile { get; set; }
public String firstName{get;set;}
public String lastName{get;set;}
public Lead l = new Lead();
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption(‘Open – Not Contacted’,’Open – Not Contacted’));
options.add(new SelectOption(‘Working – Contacted’,’Working – Contacted’));
options.add(new SelectOption(‘Closed – Converted’,’Closed – Converted’));
options.add(new SelectOption(‘Closed – Not Converted’,’Closed – Not Converted’));
return options;
}
public PageReference submitLead() {
l.FirstName=firstName;
l.LastName=lastName;
l.Company=comapany;
l.MobilePhone=mobile;
l.Status=statusOptions;
insert l;
return null;
}
}
In this example, I am calling submitLead methods from javascript.

Session settings at profile level – Winter 15 update

Now you can manage session timeout at profile level. Salesforce has provided this option in their winter 15 release. Earlier (before winter 15) we had only option to set this change at organization level. But in winter 15, you can manage session timeout at profile level. profile level changes override the organization session settings. Until you set this on a profile, the organization-wide Timeout value in the settings applies to users of the profile. Once set, the this on a profile overrides the organization-wide Timeout value for users of that profile. Changes to the organization-wide Timeout value will not apply to users of a profile with its own Session Timeout value.

where we can find these settings at org level? To find these settings at org level go to setup ->Administer-> Security controls. here you will find timeout option. See the below screen for reference.
session timeout
Where we can find these settings at profile level?
Go to setup -> administer-> Manage Users -> profile -> edit -> go to session settings & change time out value for profile. see below screen for reference.
Session Time Out At Profile Level
This option will really helpful for administrators to manage session settings at profile level.

Now you can manage password policies at profile level in salesforce

In winter’15 release salesforce has provided this feature to mange password policies like password expire in, history, length, complexity requirement, maximum invalid login attempts and lockout effective period at profile level. Earlier this option is available at organization level. Now with this winter’15 release this option is available at profile level also.

Until you set the password policies on profile, the organization policies will apply to users. Once you set the password policies at profile level, it will override organization changes. After setting password policies at profile level, if you change these settings at org – level, it won’t impact. profile settings will only apply when set these settings at profile level.

How we can set this at organization level
To find these settings at organization level, go to Settings -> Administer -> Under security controls you will find this option. see the below screen to understand.
password policies  

How can set this at profile level:
To find these settings at profile level, go to settings -> Administer -> Manage users -> profiles -> Select the profile you want to change and edit the profile to change these settings. see the below screen for reference.
password policies
 This option is available in Enterprise, performance, Unlimited and Developer editions. Need below User permissions required to edit session & password settings in profiles.
Manage permission sets & PROFILES and manage password policies.

What is a fieldset?

In this section i will explain about what is a fieldset? How can we create that? and how can we use that in a visualforce page?

Fieldset is a grouping of fields, you can use this fieldset in visualforce page to display that group of fields in that page. If you are using field set in visualforce to display fields, then you can add, remove & reorder fields very easily. No need to do code modifications to the page, In fieldset only you can add, remove & reorder fields. Generally these field sets are useful in managed packages. In manged packages , If you used field set in visualforce pages, administrators can easily add, remove and reorder fields in page. As an administrator, you can create or edit field sets and also you can edit installed fieldsets.

How to create a fieldset?
To create a fieldset, go to object, you want create fieldset by clicking on new button. Enter required fields and save. We will get below screen to add fields to field set.
Fieldset In Salesforce
Using fieldsets is very easy & you can drag and drop to arrange fields in fieldsets.

How to use field set in a visualforce page?
Below code is simple visualforce, it explains about how to use fieldset in a visualforce page.
<apex:page id=”pageId” standardcontroller=”Registration__c”>
<apex:form id=”formId”>
<apex:pageblock id=”pb”>
<apex:pageBlockSection >
<apex:repeat value=”{!$ObjectType.Registration__c.FieldSets.Registration_req_fields}” var=”fs”>
<apex:inputfield value=”{!Registration__c[fs]}”>
</apex:inputfield></apex:repeat>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton value=”Submit Details” action=”{!Save}”/>
</apex:pageBlockButtons>
</apex:pageblock>
</apex:form>
</apex:page>
The above code displays all fields in the field set. See the below screen to see the output of above code.
Fieldset
No need to change the code to re arrange fields in this page. What ever the order you created/edited in field set, the same order will display on this page.
We can easily make fields required. It is drag drop tool like page layout. To make required, double click on the field and check the required check box.

Important point about field sets:
- In the field set, you can span to fields that reference multiple objects. When you span a field into a field set that references multiple objects, the only field you can span to is the Name object.
- The total number of cross object spans within the In the Field Set container can’t exceed 25.

What is profile?

A profile is a group/collection of settings and permissions that define what a user can do in salesforce. A profile controls “Object permissions, Field permissions, User permissions, Tab settings, App settings, Apex class access, Visualforce page access, Page layouts, Record Types, Login hours & Login IP ranges.
You can define profiles by user’s job function. For example System Administrator, Developer, Sales Representative.
A profile can be assigned to many users, but user can be assigned single profile at atime.
Types of profiles in salesforce
  1. Standard profiles: By default salesforce provide below standard profiles. We cannot deleted standard ones.
  Read Only, Standard User, Marketing User, Contract Manager, Solution Manager & System Administrator. 
  Each of these standard one includes a default set of permissions for all of the standard objects available on the platform.
  2. Custom Profiles: Custom ones defined by us. They can be deleted if there are no users assigned with that particular one.
Navigation: setup -> Administer -> Manage users -> Profiles
profile
What is Permission Sets?
Permission set is also very similar to profile. What ever you can manage at profiles (Like Object permissions, Field Permissions, User permissions, Tab settings, App settings, Apex class permission, visualforce permission) the same you can manage here also. But the main difference between these two is that user can have only one profile and can have multiple permission sets at time.
So we can define profiles to grant minimum permissions and settings that every type of user needs, then we can use permission set to grant additional access.
Examples: 
1. We have many user in your organization with some fundamental job functions. We can assign all of then with one profile that grants them all access to do their job. But some set of people are working on special apps or some special functionality, for this type of special users we can create permission sets and can be assigned to them.
2. Some users need some temporary access to specific set of  fields and objects we can create permission set with those object & field access and we can assign that specific users.
Navigation: Setup -> Administer -> Manage users -> Permission sets
permission set

What is Role Hierarchies?

A role hierarchies controls level of visibility that users have to an organization data. By defining role hierarchies we can share access to records. Users assigned to roles near the top of hierarchies like (CEO, executives and other higher level roles) get to access the data of all users who fall directly below them i hierarchy.
Role hierarchies enable following behaviors.
A manager will always have access to the same data as his or her employees, regardless of the org-wide default settings. For custom objects, you can override this behavior by deselecting the Grant Access Using Hierarchies check box. However, we want our role hierarchy to apply to all of our custom objects, so leave the check boxes selected.
Users who tend to need access to the same types of records can be grouped together—we’ll use these groups later when we talk about sharing rules.
1.       What is the biggest difference between Apex and most programming languages?
·         Apex provides built-in Data Manipulation Calls(Like Insert,Update,Delete etc.,)without establishing any connections to database and closing the connections.
·         It provides default exception handling which throws an exception message automatically onto the screen unlike in other programming languages which throws error on to error console and shows abnormality.
But, Apex handles the exception and shows us on the page.
·         Embedded SOQL (Salesforce Object Query Language)and SOSL(Salesforce Object Search language) queries which returns the SObject results.
·         Apex is interpreted(compiled), executed and Controller by Force.com platform.
 
2.       Where can Apex be authored?  Where can it be executed?
                          Apex can be authored on Force.com editor which is provided in Salesforce SETUP pane on left side.
Apex classes are executed on Force.com platform. It cannot be executed on Local machines using tomcat  or any other servers.
 
3.       Why are governor limits important?  What are they based on?
A.      Governor limits are important because it controls the user to use the database interactions with limited control. Since, Force.com is a cloud platform , it offers multi-tenancy which provides unit platform for various Force.com tenants. If the governor limits are not set, and if most users start interacting with cloud database with no limit, then obvious burden will be imposed on Cloud.So, governor limits are important which determine the total pages visited by a client and total number of page navigations, a client can do in a day, total data base interactions that can be made in a single go.
Governor limits are based on the type of the Org we use.Generally, testing org contains different governer limits(more), and production org contains different governor limits(less).
 
4.       List a few characteristics of Apex that is different than other programming languages.
A.      Apex is strongly typed language with direct references TO Sobject and fields names.
       Apex is interpreted, Executed, Controlled by Force.com platform.
       Apex scripts can be saved against different versions of the Force.com API.
 
5.       How would an external program access functionality on Force.com platform?
          We have a concept called Web Services. Using this extended functionality, we can make external program access the functionality on Force.com platform.
We will generate WSDL document(Web Services Description Language) which will be exposed to host environment which results in extending the capability of accessing Force.com platform from external program.




6.       What are governor limits?  Why are these important in a multi-tenant environment?
A.      Governor limits are the database limits that are applied to the users who use Force.com platform. Governor limits simply means the limited database calls that a developer/user do.
      These governor limits are important because unlimited and free access to database many number of times from each time will slow down the database effectiveness.So,to preserve the database effectiveness, governor limits are important in multi-tenant environment.
 
7.       What is Run time type information?  How do obtain it in Apex?
A.      Run time type information refers to a system that keeps the information about an object’s data type in memory at run time. This run time information deals to integers, strings and generic objects.
 
8.       How do you override a method in Apex?
A.      With the help of the OVERRIDE key word in method signature, we can override a method in Apex.
        For example, we have a method  public void abc(){
},
If we want to override the method, we can do like below:
Public override void abc(){
}
 
9.       What are the ways in which Apex can be invoked?
A.      We can invoke apex in 4 ways:
a.       Triggers: By writing the apex triggers,and calling them on the 7 pre defined events of creating/modifying a record, we can invoke apex.
b.      Apex Schedule: We can schedule Apex code to be run at a particular point/for a particular period of time. We need to write some Apex code and schedule them using Apex Scheduler.By this way, we can invoke apex.
c.       Anonymous Blocks: Anonymous Block refers to a block, from where we can invoke apex by writing the logic we need. Example is as below:

d.      Apex in Ajax: For Apex, we have ajax took kit, from where we can do Apex calls. This Ajax toolkit can be used on the visualforce page using javascript notations. Using this Apex in Ajax, we can invoke Apex.
 
10.   What are some of the limitations of code that you can call via the anonymous block?
A.      Anonymous Block’s code execute with current user’s permission. So, if the user does not have field-level permissions or does not have profile permissions, then the code in anonymous block fails.
 
11.   How do you expose functionality on Force.com to be consumed by external clients?
A.      We have a concept called Web Services. Using this extended functionality, we can make external program access the functionality on Force.com platform.
      We will generate WSDL document(Web Services Description Language) which will be exposed to host       environment which results in extending the capability of accessing Force.com platform from external program.
 
12.   What would the syntax be to create a new class named MyNewClass which should be public?
A.      Syntax is:
       Public class MyNewClass{
}
Here public is the access modifier for the class. And CLASS  is the keyword to designate a class and MyNewClass is the name of the class.
 
13.   What is the difference between the global and public access modifier keywords?
A.      We have different access modifiers like global, private, public.
       If we use the access modifier as Global, it can be used anywhere in the org. Generally, Global is used for   web-services since one class needs to handle some other parts of apex in the org. Whenever we use Public keyword, then the access is limited to the particular class and cannot be used outside the related class.
 
14.   Is casting between a String and Integer allowed? 
       Allowed
 
 15 .What are different data types for Apex variables?
        Premitive and non premitive data types
 
16.What keywords are used to declare a constant?
Final and static
 
17.What special characters are used to surround SOQL or SOSL queries?
[ and ]
Ø  What is the maximum number of rows that can be brought back by a SOQL query?
o   50000
Ø  What advantage does using a variable list in a for loop have over a single variable?
o   Using list ,we save retrived data in a single list variable
Ø  What is different about a static method?
o   Static methods are not used in web services
Ø  What are the two types of iterations that can be performed in a for loop with a SOQL query?
o   Variable and variable_list
Ø  Does Apex use explicit transactional calls such as commit and rollback?
o   NO
Ø  The assert family of methods belong to which class?
o   System
Ø  What do the Limit class methods help you to manage?
Ø  How do you access the records that cause the trigger to execute? 
Ø  What are the seven different types of trigger events?
o   Before insert,before update,before delete
o   After insert,after update,after delete,after undelete
Ø  How do you specify that a trigger is a “bulk trigger?”
o   By default all triggers are bulk triggers
Ø  Under what identity do triggers execute?  What ramifications does that have?
Ø  Is it necessary to import a WSDL to perform a callout?
o   NO
Ø  What does the @future annotation do?  What are the other annotations available with Apex?
o   @future  is used to execute methods asynchronously.
o   @istest,@readonly,@remoteAction,@depricited
:11� :#t b 0# �O id black 1.0pt; border-top:none;mso-border-top-alt:solid black .5pt;mso-border-alt:solid black .5pt; padding:0in 5.4pt 0in 5.4pt'>
Total Heap Size
300000 Bytes
3MB
1.5MB
1.       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.
 
2.       What is the purpose of controllers?
Controllers provide the data and actions that are available to a Visualforce page.
 
3.       Which objects have associated standard controllers?
All standard and custom objects that can be accessed via the API have associated controllers
 
4.       What is included with each standard controller?
Data: the fields for the associated object record that are API accessible, including the related records (5 up/1 down).  Actions: save, delete, view, edit, cancel.
 
5.       When do you need to go beyond a standard controller and code custom Apex?
If you need data beyond the limits of what is available in the standard controller or actions that go beyond the provided standard actions.
 
6.       Compare and contrast custom controllers and controller extensions.  How are they the same?  How are they different?
Both allow for custom code to be used, allowing for custom data sets and custom actions.  Extensions leverage the existing data and actions within a standard or custom controller.  Custom controllers must contain all data and actions that need to be executed by the page.  Extensions that extend standard controller allow for the pages which use those extensions to be used in custom buttons, standard button overrides, and over declarative features.
 
7.       What identifies a controller as being an extension?
The controller must declare a constructor which takes another controller explicitly.  For example: public myControllerExtension(ApexPages.StandardController stdController) {this.acct = (Account)stdController.getRecord();  }
 
8.       Why are properties helpful in controllers?
Properties can automatically create standard getters and setters while still allowing for their customizations.  They save you from both writing the tedious code and reading the clutter when reviewing code.
 
9.       In what order do methods fire within a controller?
The only rule is that setters fire before action methods.  Aside from that, there is no guaranteed order.
 
10.   What are some Apex classes that are commonly used within controllers?
StandardController, SelectOption, PageReference, Message, etc.
 
11.   How are wizard controllers different from other controllers?
The two main issues is that they must handle multiple pages and they must maintain the state across those pages.
 
12.   What are the effects of using the transient key word?
The transient key word prevents the data from being saved into the view state.  This should be used for very temporary variables.
 
13.   When is a component controller required for custom components?
A component controller is required when business logic is required to decide how to render the component.
 
14.   What kind of content can be included in a Visualforce page?
Any content that can be rendered in a browser (HTML, JavaScript, etc.).
 
15.   What do {!expressions} refer to when used in Visualforce components?
Expressions refer to either data or actions that are made available to the page from the controller
 
16.   What are the ways that Visualpages can be incorporated into the rest of your user interface?
Basically, via links, buttons, tabs, and inline frames.
 
17.   Is it always necessary to know Apex to create Visualforce pages?  When does it become necessary?
No, it is not always necessary.  You can use standard controllers and VF component tags to accomplish quite a bit.  Apex becomes necessary when you need either a custom set of data or custom actions to be available from the page.
 
18.   What are attributes?  What is the syntax for including them?
Attributes are modifiers to the main tag that belong after the tag name in the start tag.  The syntax is attributeName=“attributeValue”
 
19.   What are three types of bindings used in Visualforce?  What does each refer to?
Data bindings refer to the data set in the controller. 
Action bindings refer to action methods in the controller. 
Component bindings refer to other Visualforce components
 
20.   What is the main difference between using dataTable vs. pageBlockTable tags?
PageBlock: For default salesforce standard format.
dataTable:To design customformats

21.   Which tag is used with both radio buttons and picklists to create the selectable values?
<Apex:selectoption> tag

22.   How many controllers can a page have?  Where is the controller for a page assigned?
One main controller (of course, it could have extensions or custom components could have controllers, etc.).  The controller is assigned in the <apex:page> tag.
 
23.   There are a series of layout components that all help recreate the traditional Salesforce page layout style very easily.  What name do they share?
   pageBlock.
 
24.   Which tags should be used to automatically bring in the Salesforce label and default widget for a field?
pageblock
 
25.   What are static resources?
Static resources are a new type of storage in Salesforce specifically designed for use in Visualforce pages.  They are ways to store images, flash files, stylesheets, and other web resources on the Salesforce servers that can be cached for better page performance. 
 
26.   What are some examples of JavaScript Events?
Onmouseover, onclieck etc.
 
27.   What is AJAX typically used for in Visualforce
AJAX is primarily used for partial page updates in Visualforce.  In s-controls, the AJAX toolkit was the soap (XML over HTTP) client that gave you access to the force.com Web Services API.
 
28.   What is the purpose of <script> tags?
Script tags allow you to create JavaScript (or other types) functions that can be used within your pages
 
29.   What are the different AJAX action tags?  What does each do?
    • actionStatus: used to display start and stop statuses of AJAX requests.
    • actionSupport: used to call a second component when an event happens to the first component.
    • actionPoller: similar to actionSupport, but the event is based on a timer instead of a user action.
    • actionFunction: provides support for invoking a controller action from JavaScript code using an AJAX request by defining a new JavaScript function.
    • actionRegion: used to demarcate which parts of the page the server should reprocess.

30.   How can you create partial page refreshes? 
Basically, you need to define the section of the page that is going to refresh (typically with a panel of sorts), and then define the event that will cause the refresh.  The method changes depending on if the area being refreshed is the same as the one handling the event.  It also depends on if you are just processing something on the server, or if you need the UI to change. 
 
31.   Which tag is used with both radio buttons and picklists to create the selectable values?
<apex:selectOption>
 
32.   What is the purpose of creating attributes on components? 
By allowing the component to take parameters via an attribute, you can make the component more flexible and reusable
 
    33.What are the Global Key words?
        We have global keywords like component,User,url,current page etc., to access various values from      components on page, from user object or from url or from current page fields. To access value from each source, we have different global keywords. One such keyword is explained in above question(!$component)
Various global keywords are:
i.                     URL
ii.                   USER
iii.                  PROFILE
iv.                 Resource
v.                   Component
vi.                 Current page
vii.                Page reference etc.

34.How can you access visualforce components values into a JavaScript?
Using Component global variable, we can access visualforce components in javascript. Let us suppose, we want to use id of an apex field with id=”afield”.
So, we can use the {!$Component.afield} syntax to use properties of the field in javascript.
Let us suppose, we want to store the field’s value in java script, then we can use like below:
<script>
Var a =’ document.getElementById('{!$component.afield}').value’;
</script>


35.What are the Gov Limits in Salesforce.com?

Because Apex runs in a multitenant environment, the Apex runtime engine strictly enforces a     number of limits to ensure that
runaway scripts do not monopolize shared resources. These limits, or governors, track and enforce the statistics outlined in the following table. If a script ever exceeds a limit, the associated governor issues a runtime exception that cannot be handled.
Governor limits can be extended from release to release.


Trigger
Class
Test
Total number of SOQL’s
20
100
100
    Total number of                SOSL’s
0
20
20
Total number of records Retrieved by single SOQL Query
1000
10000
500
Total number of records Retrieved by single SOSL Query
0
200
200
Total Number Of  Call out Methods
10
10
10
Total number of send email methods allowed
10
10
10
Total Heap Size
300000 Bytes
3MB
1.5MB