Saturday, 4 February 2017

Salesforce Interview Questions

Difference between insert and database.insert?

We can insert data in salesforce using insert and database.insert. One difference between the two options is that by using the Database class method, you can specify whether or not to allow for partial record processing if errors are encountered. You can do so by passing an additional second Boolean parameter. If you specify false for this parameter and if a record fails, the remainder of DML operations can still succeed. By default, this optional parameter is true, which means that if at least one sObject can’t be processed, all remaining sObjects won’t and an exception will be thrown for the record that causes a failure.

  • Use DML statements if you want any error that occurs during bulk DML processing to be thrown as an Apex exception that immediately interrupts control flow (by using try. . .catch blocks). 
  • Use Database class methods if you want to allow partial success of a bulk DML operation—if a record fails, the remainder of the DML operation can still succeed. Your application can then inspect the rejected records and possibly retry the operation. When using this form, you can write code that never throws DML exception errors. 
  • The Database class also provides methods not available as DML statements, such as methods transaction control and rollback, emptying the Recycle Bin, and methods related to SOQL queries.

What is Order of Execution in a Visualforce Page?

When a user views a Visualforce page, instances of the controller, extensions, and components associated with the page are created by the server. The order in which these elements are executed can affect how the page is displayed to the user.There are two types of Visualforce page requests:
  • get request is an initial request for a page either made when a user enters an URL or when a link or button is clicked that takes the user to a new page.
  • postback request is made when user interaction requires a page update, such as when a user clicks on a Save button and triggers a save action.

What is apex:composition tag?

The <apex:composition> component names the associated template, and provides body for the template's <apex:insert> components with matching <apex:define> components. Any content outside of an <apex:composition> component is not rendered.

<!-- Page: composition -->
<!-- This page acts as the template. Create it first, then the page below.  --> 
<apex:page>
 <apex:outputText value="(template) This is before the header"/><br/>
 <apex:insert name="header"/><br/>
 <apex:outputText value="(template) This is between the header and body"/><br/>
 <apex:insert name="body"/>
</apex:page>
   
<!-- Page: page -->
<apex:page>
 <apex:composition template="composition">
  <apex:define name="header">(page) This is the header of mypage</apex:define>
  <apex:define name="body">(page) This is the body of mypage</apex:define>
 </apex:composition> 
</apex:page>

output:- (template) This is before the header<br/>
(page) This is the header of mypage<br/>
(template) This is between the header and body<br/>
(page) This is the body of mypage

What are trigger best practices? 


Can we deploy code between two sandboxes using change set?

No. You can upload a change set from one sandbox to another sandbox, or from sandbox to production, and vice versa.

Refer https://trailhead.salesforce.com/modules/app_deployment/units/app_deployment_changesets

What is change set limitation?

Change sets are limited to 10,000 files. If your change set exceeds this limit, you can create separate change sets for email templates, dashboards, and reports. These components are often the most numerous and have fewer dependencies.

How many types of sandboxes we have in salesforce?

Developer Sandbox - This sandbox is for development and testing. It contains the metadata of production org.
Developer Pro Sandbox - A Developer Pro sandbox is intended for development and testing in an isolated environment and can host larger data sets than a Developer sandbox. A Developer Pro sandbox includes a copy of your production org’s configuration (metadata).  Use a Developer Pro sandbox to handle more development and quality assurance tasks and for integration testing or user training.
Partial Copy Sandbox - A Partial Copy sandbox is intended to be used as a testing environment. This environment includes a copy of your production org’s configuration (metadata) and a sample of your production org’s data as defined by a sandbox template. Use a Partial Copy sandbox for quality assurance tasks such as user acceptance testing, integration testing, and training.
Full Sandbox - A Full sandbox is intended to be used as a testing environment. Only Full sandboxes support performance testing, load testing, and staging. Full sandboxes are a replica of your production org, including all data, such as object records and attachments, and metadata. The length of the refresh interval makes it difficult to use Full sandboxes for development.

What is the limitation of joined report?

We can display up to 2000 records only.

What are the different code migration tool?

Force.com Migration Tool

Change Sets



What is the difference between Change set and Force.com Migration Tool?







What is custom label?

We can display error message or help text is user's language using custom label. Custom labels are custom text values that can be accessed from Apex classes, Visualforce pages, or Lightning components. The values can be translated into any language Salesforce supports.


Difference between static resource and documents in salesforce.

  • Static resources are data cached and you can refer them easily in VF (including zip files) which store on Sales force server.
  • Static Resources and Documents are having an absolute limit of 5MB for each document.
  • You can package a collection of related files into a directory hierarchy and upload that hierarchy as a .zip or .jar archive), images, style sheets, JavaScript, and other files.
  • You can reference a static resource by name in page markup by using the $Resource global variable instead of hard-coding document IDs.
  • JavaScript or CSS is preferable to including the markup inline. Managing this kind of content using static resources allows you to have a consistent look and feel for all your pages and shared set of JavaScript functionality.


What is StandardSetController?

StandardSetController allows us to create list controllers similar to, or as extensions of, the pre-built Visualforce list controllers provided by Salesforce

From a list of sObjects:
List<account> accountList = [SELECT Name FROM Account LIMIT 20];
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(accountList);

From a query locator:
ApexPages.StandardSetController ssc = 
new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Name,
CloseDate FROM Opportunity]));

What are custom controller and extension?

custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.
controller extension is an Apex class that extends the functionality of a standard or custom controller. Use controller extensions when:
  • You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete.
  • You want to add new actions.
  • You want to build a Visualforce page that respects user permissions. 
Example 

 <Apex:page controller="MyClass"> ....</apex:page>
 <apex:page standardController="account" extensions="MyExtClass"...> ... </apex:page>

Like other Apex classes, controller extensions run in system mode. Consequently, the current user's credentials are not used to execute controller logic, and the user's permissions and field-level security do not apply. However, if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, in which the permissions, field-level security, and sharing rules of the current user apply.

How many components can be added in dashboard?

20

What are the different components available in dashboard?

Vertical Bar Chart
Horizontal Bar Chart
pie chart
Donut
Visual force
Table

What are the Salesforce version controlling tools?
Github

What is visualforce page life cycle?
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_lifecycle.htm


10 comments:

  1. can we get answers for these

    ReplyDelete
  2. Thanks alot, really helpful

    ReplyDelete
  3. Thanks a lot for wonderful comments

    ReplyDelete
  4. The Salesforce interview questions are very much useful My sincere thanks for sharing this post and please continue to share this kind of post
    Salesforce Training in Chennai

    ReplyDelete
  5. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information&its very useful to me. Keep update thank you. Salesforce Training in Chennai | Cloud Computing Training in Chennai

    ReplyDelete
  6. Thanks a lot everyone for viewing this blog. I will post soon.

    ReplyDelete
  7. Welcome Vamshi. I will be sharing salesforce videos soon. Stay tune

    ReplyDelete

Please add your comments here