Salesforce Interview Questions

How can we improve VisualForce Page Performance?
Hint:- 1. Reduce view state
2. Reduce load time
3. Careful use of multiple concurrent requests
4. Queries and security- using with sharing keyword
5. Preventing field values from dropping off the page.

For more information, please open following link-
http://www.salesforce.com/docs/developer/pages/Content/pages_best_practices_performance.htm

What is View state? How can we reduce this?
Visualforce pages that contain a form component also contain an encrypted, hidden form field that encapsulates the view state of the page. This view state is automatically created, and as its name suggests, it holds the state of the page – state that includes the components, field values and controller state.
Best practices for optimising view state-
1. Minimize number of forms on a page.
2. Declare variables as transient to reduce view state
3. Recreate State versus Storing It in View State
4. Use Custom Objects or Custom Settings to Store Large Quantities of Read-Only Data
5. Refine Your SOQL to Retrieve Only the Data Needed by the Page
6. Refactor Your Pages to Make Its View Stateless
7. Consider Doing Your Own State Management in Certain Cases

For more information, please open the following link-
https://developer.salesforce.com/page/An_Introduction_to_Visualforce_View_State

What are the salesforce components which we can’t deploy?
1. Email services
2. Web to case
3. Self-service portal setting
4. Self-service portal users
5. Organization wide email addresses
6. Fiscal year
7. Lead setting
8. Self service portal font and color
9. Search settings
10. Site.com
11. tag settings
12. Console layouts
13. Analytic setting

For more information, please open the following link-

Profile, Permission setting, roles, sharing rules, manual sharing and OWD
Profiles:- Permissions or collections of settings that defines what a user can do in salesforce.
Permission sets:- Permission set are very similar to profiles. Whatever you can define using profile, you can define using permission set. The main difference is that user can have one profile but many permission sets at a time. So we can define profile to give minimum level of access that every type of user need, then we can use permission set to give additional access. 

Role Hierarchy:- Role Hierarchy enables users above another users in hierarchy to have same level of access to the records owned by or shared with the user below.
Sharing Rules:- used by administrator to grant users within a group or roles access to records owned by a specific group of users.
Manual Sharing:- Manual sharing allows the record owner or the user with full access to a record to share the record with a user or a group of users.
OWD:– to define default sharing setting for an organisation.

Merge Triggers?
Merge trigger don’t fire their own event. Instead they fire delete and update events as follows-
1. deletion of losing record and
2. updation of wining record.
For example:- If two contacts are merged, only update and delete trigger fire. No trigger for records related to contact, such account or opportunity, fires.

For more information, open the following links-
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_merge_statements.htm

Apex best practices
1. Bulkify your code
2. Avoid soql queries or DML inside for loops
3. Bulkify your helper class
4. Using collections, streamlining queries and efficient for loops
5. Querying large set of data
6. Use of limit apex methods to avoid hitting governor limits
7. Using @future appropriately.
8. Writing test methods to verify large datasets
9. Avoid hard-coded Ids
10 .Streamlining multiple triggers on the same object.

For more information, open following link-
https://developer.salesforce.com/page/Apex_Code_Best_Practices

Force.com Rest Apis?
Force.com rest apis lets you use a simple and lightweight api access to force.com data using OAuth, together with a data flavors- XML and JSON. The rest api is out of box to suit basic CRUD operation.

Setting up an apex rest endPoint:-
@RestResource(urlMapping = ‘/FieldCase/*’)
global with sharing class RestCaseControllerClass {
This will define ‘FieldCase’ an accessible endpoint and full URI would be constructed from your instance URL constructed with ‘services/apexrest/FieldCase.’

Using GET and DELETE:-
HTTP GET defines data as a series of query parameters in the URI itself. For eg. here is the URI:
https://na8.salesforce.com/services/apexrest/FieldCase?companyName=GenePoint

@HttpGet
global static List getOpenCases() {
String campanyName = RestContext.request.params.get(‘campanyName’);
//return query here
}

Using PUT, PATCH and POST:-
Accessing Binary data using RESTRequest Object:-

For more information, please go to following link-
https://developer.salesforce.com/page/Creating_REST_APIs_using_Apex_REST

Salesforce Integration using SOAP based web services?
WSDL:- is an xml file that defines Remote application’s method and data that have been exposed via a URI. 
 For more information:-
http://th3silverlining.com/2010/03/28/salesforce-integration-using-wsdls/


Web Service Methods:-
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_web_services_methods.htm

SOAP, REST, Bulk and MetaData APIs?
SOAP API
Use SOAP API to create, retrieve, update or delete records, such as accounts, leads, and custom objects. With more than 20 different calls, SOAP API also allows you to maintain passwords, perform searches, and much more. Use SOAP API in any language that supports Web services.
REST API
REST API provides a powerful, convenient, and simple REST-based Web services interface for interacting with Salesforce. Its advantages include ease of integration and development, and it’s an excellent choice of technology for use with mobile applications and Web projects. However, if you have a large number of records to process, you may wish to use Bulk API, which is based on REST principles and optimized for large sets of data.
Bulk API
Bulk API is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, insert, update, upsert, or delete a large number of records asynchronously by submitting batches which are processed in the background by Salesforce.
SOAP API, in contrast, is optimized for real-time client applications that update small numbers of records at a time. Although SOAP API can also be used for processing large numbers of records, when the data sets contain hundreds of thousands of records, it becomes less practical. Bulk API is designed to make it simple to process data from a few thousand to millions of records.
Metadata API
Use Metadata API to retrieve, deploy, create, update, or delete customizations for your organization. The most common use is to migrate changes from a sandbox or testing organization to your production environment. Metadata API is intended for managing customizations and for building tools that can manage the metadata model, not the data itself.

Published by Sandeep Kumar

He is a Salesforce Certified Application Architect having 11+ years of experience in Salesforce.

2 thoughts on “Salesforce Interview Questions

  1. Hi There,Salesforce Interview Questions being contrived to exist for many projects simply so it can be run will be the first to hit the wall, but those projects where the functions to make existing transactions cheaper in real world applications will find the elusive real world demand.Change SetsUtilize changesets to send customizations starting with one Salesforce organization then onto the next. For instance, you can make and test another object in a sandbox organization, at that point send it to your production organization utilizing a changeset. Changesets can just contain adjustments you can make through the Setup menu. For instance, you can't utilize a change set to transfer contact records. Change sets contain data about the organization(Metadata). They don't contain information, for example, records.I read multiple articles and watched many videos about how to use this tool – and was still confused! Your instructions were easy to understand and made the process simple.Thanks and Regards,Preethi.

Leave a Reply