salesforce-crm-course-bangalore

Salesforce is the leader in cloud computing, offering applications for all aspects of your business, including CRM, sales, ERP, customer service, marketing automation, business analytics, mobile application building, and much more.

Here are some important interview questions on Salesforce.

1.Can two users have the same profile? Can two profiles be assigned to the same user?
Answer:   Profiles decide the dimension of access a client can have in a Salesforce organization.

To the extent the initial segment of the inquiry is concerned, yes. One profile can be doled out to any number of clients. Take the case of a Sales or Service group in an organization. The whole group will be allocated a similar profile. The administrator can make one profile: Sales Profile, which will approach the Leads, Opportunities, Campaigns, Contacts and different articles esteemed essential by the organization.

Along these lines, numerous clients can be appointed a similar profile. On the off chance that the group captain or chief need access to extra records/protests then it tends to be finished by allotting consent sets just for those clients.

Answering the second part of the question, each user can only be assigned 1 profile.

2. What are Governor Limits in Salesforce?
Answer:  In Salesforce, it is the Governor Limits which controls how much information or what number of records you can store in the mutual databases. Why? Since Salesforce depends on the idea of multi-inhabitant engineering. In more straightforward words, Salesforce uses a single database to store the data of multiple clients/ customers.

To ensure no single customer consumes the common assets, Salesforce presented the idea of Governor Limits which is entirely implemented by the Apex run-time engine.

Governor Limits are a Salesforce developer’s greatest test. That is in such a case that the Apex code ever surpasses the limit, the normal representative issues a run-time exemption that can’t be taken care of. Henceforth as a Salesforce developer, you must be exceptionally watchful while building up your application.

Different Governor Limits in Salesforce are:

Per-Transaction Apex Limits

Force.com Platform Apex Limits

Static Apex Limits

Size-Specific Apex Limits

Miscellaneous Apex Limits

Email Limits

Push Notification Limits

3. What is a sandbox org? What are the different types of sandboxes in Salesforce?
Answer : A sandbox is a copy of the production environment/organization, utilized for testing and advancement purposes. It’s helpful on the grounds that it permits advancement on Apex programming without irritating the creation condition.

When can you use it?

You can utilize it when you need to test a recently created Force.com application or Visualforce page. You can create and test it in the Sandbox organization as opposed to doing it specifically underway.  This way, you can build up the application with no problem and after that relocate the metadata and information (if appropriate) to the production environment. Doing this in a non-production environment allows developers to freely test and experiment applications end to end.

Types of Sandboxes are:

Developer

Developer Pro

Partial Copy

Full

4. Can you edit an apex trigger/ apex class in production environment? Can you edit a Visualforce page in production environment?
Answer : No, it is not possible to edit apex classes and triggers directly in production environment. It needs to be done first in Developer edition or testing org or in Sandbox org. Then, to deploy it in production, a user with Author Apex permission must deploy the triggers and classes using deployment tools. However, Visualforce pages can be created and edited in both sandbox and in production.

Only if the page has to do something unique (different values), it would have to be developed via Sandbox.

5. What are the different data types that a standard field record name can have?
Answer : A standard field record name can have data type of either auto number or text field with a limit of 80 chars. For generating auto numbers, the format needs to be specified while defining the field and after that for every record that is added, the number will get auto generated. For example:

Sr No – {1}

Sr No – {2}

Sr No – {3}

6.Why are Visualforce pages served from a different domain?
Answer : Visual force pages are served from an alternate domain to enhance security principles and square cross site scripting.

7. What is WhoId and WhatId in activities?
Answer : WhoID refers to individuals. Normally: contacts or leads. Example: Lead ID, Contact ID 

WhatID alludes to objects. Example: Account ID, Opportunity ID

8. What is the use of writing sharing rules? Can you use sharing rules to restrict data access?
Answer :  Sharing rules are written to give edit access (public read and write) or public read only access to certain individuals in Salesforce org. A classic example is when:- only your managers or superiors need to be given extra credentials to your records in objects as compared to your peers.

As a matter of course, all clients in your association will have association wide-default sharing settings of either Public Read Only or Private.

To offer access to more records, which clients don’t possess, we compose sharing principles.

Example: Sharing rules are used to extend sharing access to users in public groups or roles. Hence, sharing rules are not as strict as organization-wide default settings. They allow greater access for those users.

As far as the second part of the question is concerned, the answer is no. We cannot use sharing rules to restrict data access. It is only used for allowing greater access to records.

9.What are the different types of email templates that can be created in Salesforce?
Answer :  The different types of Email templates are listed as below:-

Text: All users can create or change this template

HTML with letterhead: Only Administrators and users having “Edit HTML Templates” permissions can create this template based on a letterhead.

Custom HTML: Administrators and users having “Edit HTML Templates” permissions can create this template without the need of a letterhead

Visualforce : Only administrators and developers can create this template. Advanced functionalities like merging data from multiple records is available only in this template

10. What is a bucket field in reports?
Answer : A bucket field lets you group related records together by ranges and segments, without the use of complex formulas and custom fields. Bucketing can thus be used to group, filter, or arrange report data. When you create a bucket field, you need to define multiple categories (buckets) that are used to group report values.

The advantage is that earlier, we had to create custom fields to group or segment certain data.

Salesforce-Inteview-Questions-and-Answers

11.What are the different types of object relations in salesforce? How can you create them?
Answer : The different types of object relationships in Salesforce are:

Master-Detail Relationship (1:n):- It is a parent-child relationship in which the master object controls the behavior of the dependent child object. It is a 1:n relationship, in which there can be only one parent, but many children.The main concept you need to be know is that, being the controlling object, the master field cannot be empty. If a record/ field in master object is deleted, the corresponding fields in the dependent object are also deleted. This is called a cascade delete. Dependent fields will inherit the owner, sharing and security settings from its master.You can define master-detail relationships between two custom objects, or between a custom object and standard object as long as the standard object is the master in the relationship.
Lookup Relationship (1:n):-Lookup relationships are used when you want to create a link between two objects, but without the dependency on the parent object. Similar to Master-Detail relationship, you can think of this as a form of parent-child relationship where there is only one parent, but many children i.e. 1:n relationship.The difference here is that despite being controlling field, deleting a record will not result in automatic deletion of the lookup field in the child object. Thus the records in the child object will not be affected and there is no cascade delete here. Neither will the child fields inherit the owner, sharing or security settings of its parent.
Junction Relationship (Many-To-Many):-This kind of a relationship can exist when there is a need to create two master-detail relationships. Two master-detail relationships can be created by linking 3 custom objects. Here, two objects will be master objects and the third object will be dependent on both the objects. In simpler words, it will be a child object for both the master objects.

12. What happens to detail record when a master record is deleted? What happens to child record when a parent record is deleted?
Answer : In a Master-Detail relationship, when a master record is deleted, the detail record is deleted automatically (Cascade delete).

In a Lookup relationship, even if the parent record is deleted, the child record will not be deleted.

13.Can you have a roll up summary field in case of Master-Detail relationship?
Answer : Yes. You can have a roll-up summary in case of a master-detail relationship. But not in case of a lookup relationship.

A roll-up summary field is used to display a value in a master record based on the values of a set of fields in a detail record. The detail record must be related to the master through a master-detail relationship.

There are 4 calculations that you can do using roll-up summary field. You can count the number of detail records related to a master record. Or, you can calculate the sum, minimum value, or maximum value of a field in the detail records

14.Explain the term “Data Skew” in Salesforce.
Answer : “Data skew” is a condition which you will encounter when working for a big client where there are over 10,000 records. When one single user owns that many records we call that condition ‘ownership data skew’.

When such users perform updates, performance issues will be encountered because of “data skew”. This happens when a single user/ members of a single role own most of the records for a particular object.

15. Explain skinny table. What are the considerations for Skinny Table?
Answer : In Salesforce, skinny tables are used to access frequently used fields and to avoid joins. This largely improves performance. Skinny tables are highly effective, so much so that even when the source tables are modified, skinny tables will be in sync with source tables.

Considerations for skinny tables:

Skinny tables can contain a maximum of 100 columns.

Skinny tables cannot contain fields from other objects.

For full sandboxes: Skinny tables are copied to your Full sandbox organizations, as of the Summer ’15 release.

16. Which fields are automatically Indexed in Salesforce?
Answer :  Only the following fields are automatically indexed in Salesforce:

Primary keys (Id, Name and Owner fields).

Foreign keys (lookup or master-detail relationship fields).

Audit dates (such as SystemModStamp).

Custom fields marked as an External ID or a unique field.

17. How to handle comma within a field while uploading using Data Loader?
Answer :  In a Data Loader .CSV, if there is a comma in field content, you will have to enclose the contents within double quotation marks: ” “.

18. For which criteria in workflow “time dependent workflow action” cannot be created?
Answer : Time dependent workflow action cannot be create for: “created, and every time it’s edited”.

19. What are the types of custom settings in Salesforce? What is the advantage of using custom settings?
Answer :  There are two types of custom settings in Salesforce: List Custom Settings and Hierarchy Custom Settings.

List Custom Settings are a type of custom settings that provides a reusable set of static data that can be accessed across your organization irrespective of user/ profile.

Hierarchy Custom Settings are another type of custom settings that uses built-in hierarchical logic for “personalizing” settings for specific profiles or users.

The advantage of using custom settings is that it allows developers to create a custom set of access rules for various users and profiles.

20. How many active assignment rules can you have in a lead/ case?
Answer : Only one rule can be active at a time.

Salesforce-Inteview-Questions-and-Answers-1

21. What are custom labels in Salesforce? What is the character limit of custom label?
Answer : Custom labels are custom text values that can be accessed from Apex classes or Visualforce pages. The values here can be translated into any language supported by Salesforce.

Their benefit is that they enable developers to create multilingual applications which automatically presents information in a user’s native language.

You can create up to 5,000 custom labels for your organization, and they can be up to 1,000 characters in length.

22. What is the difference between a Role and Profile in Salesforce?
Answer :  As mentioned in one of the previous Salesforce interview questions, a profile will ultimately control access to which records a user has in a Salesforce org. No user can work on the Salesforce org without being assigned a profile. The Profile is therefore mandatory for every user.

Role however is not mandatory for every user. The primary function of the Role/ Role hierarchy is that it allows higher level users in hierarchy get access to records owned by lower level users in the hierarchy. An example of that is Sales Managers getting access to records owned by Sales Reps while their peers do not get access to it.

23. What are the examples of non-deterministic Force.com formula fields? 
Answer : Before I mention some of the examples, let me give you an introduction to deterministic and non-deterministic formula fields. Formula fields whose value will be static are referred to as deterministic fields. Whereas, formula fields whose value will be changed dynamically or whose values will have to be calculated on the fly, they are referred to as non-deterministic formula fields. A classic example of that is a formula returning the current date and time.

Some examples of non-deterministic fields in Force.com are:

Lookup fields

Formula fields whose reference spans over other entities

Fields having dynamic date functions like:- TODAY() or NOW()

24. Why do we need to write test classes? How to identify if a class is a test class?
Answer : Software developers from around the world will unanimously agree that writing code in test classes makes debugging more efficient. Why? That is because test classes help in creating robust and error-free code be it Apex or any other programming language. Since Unit tests are powerful in their own right, Salesforce requires you to write test classes in Apex code

Why are they so powerful? Because test classes and test methods verify whether a particular piece of code is working properly or not. If that piece of code fails, then developers/ testers can accurately locate the test class having the faulty bug.

Test classes can be determined easily because every test class will be annotated with @isTest keyword. In fact, if we do not annotate a test class with @isTest, then it cannot be defined as a test class. Similarly, any method within a class which has the keyword testMethod, is a test method.

25. What is minimum test coverage required for trigger to deploy?
Answer : In Salesforce, if you want to deploy your code to production, then you must make sure that at least 75% of your Apex code is covered by unit tests. And all these tests must complete successfully.

26. What are the different ways of deployment in Salesforce?
Answer : You can deploy code in Salesforce using:

Change Sets

Eclipse with Force.com IDE

Force.com Migration Tool – ANT/Java based

Salesforce Package

27. What is an external ID in Salesforce? Which all field data types can be used as external IDs?
Answer : An external ID is a custom field which can be used as a unique identifier in a record. External IDs are mainly used while importing records/ data. When importing records, one among the many fields in those records need to be marked as an external ID (unique identifier).

An important point to note is that only custom fields can be used as External IDs. The fields that can be marked as external IDs are: Text, Number, E-Mail and Auto-Number.

28. How many callouts to external service can be made in a single Apex transaction?
Answer : Governor limits will restrict a single Apex transaction to make a maximum of 100 callouts to an HTTP request or an API call.

29. How can you expose an Apex class as a REST WebService in Salesforce?
Answer :  You can expose your Apex class and methods so that external applications can access your code and your application through the REST architecture. This is done by defining your Apex class with the @RestResource annotation to expose it as a REST resource. You can then use global classes and a WebService callback method.

Invoking a custom Apex REST Web service method always uses system context. Consequently, the current user’s credentials are not used, and any user who has access to these methods can use their full power, regardless of permissions, field-level security, or sharing rules.

Developers who expose methods using the Apex REST annotations should therefore take care that they are not inadvertently exposing any sensitive data.

30. What is the difference between a standard controller and a custom controller?
Answer : Standard controller in Apex, inherits all the standard object properties and standard button functionality directly. It contains the same functionality and logic that are used for standard Salesforce pages.

Custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Custom Controllers are associated with Visualforce pages through the controller attribute.

Salesfrce-Interview-Questions-and-Answers

31. How can we implement pagination in Visualforce?
Answer : To control the number of records displayed on each page, we use pagination. By default, a list controller returns 20 records on the page. To customize it, we can use a controller extension to set the pageSize.

32. How can you call a controller method from JavaScript?
Answer : To call a controller method (Apex function) from JavaScript, you need to use actionfunction.

33. How to get the UserID of all the currently logged in users using Apex code?
ANS :  You can get the ID’s of all the currently logged in users by using this global function: UserInfo.getUserId().

34. How many records can a select query return? How many records can a SOSL query return?
Answer : The Governor Limits enforces the following:-

Maximum number of records that can be retrieved by SOQL command: 50,000.

Maximum number of records that can be retrieved by SOSL command: 2,000.

35. What is an attribute tag? What is the syntax for including them?
Answer : An attribute tag is a definition of an attribute of a custom component and it can only be a child of a component tag.

Note that you cannot define attributes with names like id or rendered. These attributes are automatically created  for all custom component definitions.

36. What are the three types of bindings used in Visualforce? What does each refer to?
Answer : There are three types of bindings used in Salesforce:-

Data bindings, which refer to the data set in the controller

Action bindings, which refer to action methods in the controller

Component bindings, which refer to other Visualforce components.

Data bindings and Action bindings are the most common and they will be used in every Visualforce page.

37. What are the different types of collections in Apex? What are maps in Apex?
Answer : Collections are the type of variables which can be used to store multiple number of records (data).

It is useful because Governor Limits restrict the number of records you can retrieve per transaction. Hence, collections can be used to store multiple records in a single variable defined as type collection and by retrieving data in the form of collections, Governor Limits will be in check. Collections are similar to how arrays work.

There are 3 collection types in Salesforce:

Lists

Maps

Sets

Maps are used to store data in the form of key-value pairs, where each unique key maps to a single value.
Syntax: Map<String, String> country_city = new Map<String, String>();

38. How can you embed a Visualflow in a Visualforce page?
Answer : 1.  Find the flow’s unique name.

From Setup, enter Flows in the Quick Find box, then select Flows.

Click the name of the flow.

Copy the unique name of the flow.

From Setup, enter Visualforce Pages in the Quick Find box, then select Visualforce Pages.

Define a new Visualforce page, or open an existing one.

Add the <flow:interview> component somewhere between the <apex:page> tags.

Set the name attribute to the unique name of the flow.

For example:

</apex:page>

<flow:interview name=”flowuniquename”/>

<apex:page>

Click Save.

Restrict which users can access the Visualforce page.

Click Visualforce Pages.

Click Security next to your Visualforce page.

Move all the appropriate profiles from Available Profiles to Enabled Profiles by using the ‘add’ and ‘remove’ buttons.

Click Save.

Add the Visualforce page to your Force.com app by using a custom button, link, or Visualforce tab.

39. What is the use of “@future” annotation?
Answer : Future annotations are used to identify and execute methods asynchronously. If the method is annotated with “@future”, then it will be executed only when Salesforce has the available resources.

For example, you can use it while making an asynchronous web service callout to an external service. Whereas without using the annotation, the web service callout is made from the same thread that is executing the Apex code, and no additional processing will occur until that callout is complete (synchronous processing).

40. What are the different methods of batch Apex class? 
Answer : Database.Batchable interface contains three methods that must be implemented:

Start method:

global (Database.QueryLocator | Iterable<sObject>) start(Database.BatchableContext bc) {}

Execute method:

global void execute(Database.BatchableContext BC, list<P>){}

Finish method:

global void finish(Database.BatchableContext BC){}

Salesforce-Interview-Questions-and-Answers

41. What is a Visualforce component? 
Answer : A Visualforce Component is either a predefined component (standard from component library) or a custom component that determines the user interface behavior. For example, if you want to send the text captured from the Visualforce page to an object in Salesforce, then you need to make use of Visualforce components. Example: <apex:detail>

42. What is Trigger.new? 
Answer : Triger.new is a command which returns the list of records that have been added recently to the sObjects. To be more precise, those records will be returned which are yet to be saved to the database. Note that this sObject list is only available in insert and update triggers, and the records can only be modified in before triggers.

But just for your information, Trigger.old returns a list of the old versions of the sObject records. Note that this sObject list is only available in update and delete triggers.

43. What all data types can a set store? 
Answer : Sets can have any of the following data types:

Primitive types

Collections

sObjects

User-defined types

Built-in Apex types

44. What is an sObject type? 
Answer : An sObject is any object that can be stored in the Force.com platform database. Apex allows the use of generic sObject abstract type to represent any object.

For example, Vehicle is a generic type and Car, Motor Bike all are concrete types of Vehicle.
In SFDC, sObject is generic and Account, Opportunity, CustomObject__c are its concrete type.

45. What is the difference between SOQL and SOSL? 
Answer : The differences are mentioned in the table below:

SOQL vs SOSL

SOQL (Salesforce Object Query Language) SOSL (Salesforce Object Search Language)
Only one object can be searched at a time Many objects can be searched at a time
Can query any type of field Can query only on email, text or phone
Can be used in classes and triggers Can be used in classes, but not triggers
DML Operation can be performed on query results DML Operation cannot be performed on search results
Returns records Returns fields

46. What is an Apex transaction?
Answer : An Apex transaction represents a set of operations that are executed as a single unit. The operations here include the DML operations which are responsible for querying records. All the DML operations in a transaction either complete successfully, or if an error occurs even in saving a single record, then the entire transaction is rolled back.

47. What is the difference between public and global class in Apex?
Answer : Global class is accessible across the Salesforce instance irrespective of namespaces.
Whereas, public classes are accessible only in the corresponding namespaces.

48. What are getter methods and setter methods?
Answer : Get (getter) method is used to pass values from the controller to the VF page.
Whereas, the set (setter) method is used to set the value back to controller variable.

I hope this set of Salesforce interview questions will help you ace your job interview. As the next step for your career, check out the various certifications offered by Salesforce here: Salesforce Certifications. It will also help you to understand the job roles and chalk out a career path for yourself.

49. What is Apex in Salesforce?
Answer : Apex is a strongly typed object-oriented programming language.
It allows the developer to execute flows and transaction control statements.
Apex enables developers to add business logic to most system events like button clicks related record updates and visualforce pages

50. What is Apex Programming Language?
Answer :
Integrated: It provides built-in support for DML Calls
Inline Salesforce Object Query Language
Easy to Use
Easy to Test
Version
Multi Tenant Aware Application

Salesforce-Interview-Questions-and-Answers.jpg1

51. When Should I Use Apex?
Answer : To create Email services

Create web services

Perform complex validation over multiple objects

To create complex business processes that are not supported by workflow.

Create custom transaction logic

Attach custom logic to another operation

52. How Does Apex Work?
Answer : All Apex programs runs entirely ON-Demand on Force.com Platform.

First the platform application server compiles the code into abstract set of instructions that can be understood by Apex runtime interpreter.
The compile code is stored to metadata.
When the end users triggers the execution of Apex by clicking button or visualforce page the application servers retrieves the compiled instructions from the metadata and send them to runtime interpreter before returning the result.

53. What is Apex Email Service?
Answer : Email services is an automated process that use Apex classes to process the contents, Headers, Attachments of Inbound Email.

Note:
Visualforce email templates cannot be used for mass emails.
We can associate each email services with one or more salesforce generated email address to which the users can send messages for processing.

54. What is Map Class in Apex Salesforce?
Answer : Map Class Contains methods for the Map collection type.

A Map is collection of key values pairs where each unique key maps to a single value.

Map keys and values can be any data type primitive types, collections, sObjects, users defined types, and built in Apex Types.

For Example, the following table represents a map of countries and currencies

Country(Key) Currency (Value)
‘United States’ ‘Dollar’
‘Japan’ ‘Yen’
;France’ ‘Euro’
‘England’ ‘Pound’
‘India’ ‘Rupee’

55. What is SOQL?
Answer: A query language that allows you to construct simple but powerful query strings and to specify the criteria that should be used to select the data from the platform database. SOQL Stands for Slaesforce Object Query Language.

56. What Are The Types of SOQL Statements in SalesForce?
Answer : Salesforce Object Query Language is used to query that records from the database.com based on the requirement.

There are 2 types of SOQL Statements.

Static SOQL
Dynamic SOQL
1.Static SOQL: The oStatic SOQL Statement is written in []  (Array Brackets)

This statements are similar to IINQ(Ion Integrated Query)

Example:

String search for =’Jones’;

Contact[] contacts=[select testfield__c, FirstName, LastName from Contact Where Last Name=:search for];

Dynamic SOQL:
It is used to refer to the creation of a SOQL string at run time with Apex code.

Dynamic SOQL enables you to create more flexible application.

To create Dynamic SOQL query at run time use Database.Query() method, in one of the following ways.

Return a single sObjects when the query returns a single record.

sObjects s = Database. Query(String_limit_l);

Return a list of sObjects when the query returns more than a single record.

Examples:

Eg1:

String myTestString = ‘TestName’;

List List= Database.Query(SELECT Id FROM MyCustomObject__c WHERE Name = :myTestString);

Eg2:

String resolviedfield L = myvariable.field__c;

List L = Database.Query(‘SELECT Id FROM myCustomObject__c WHERE field__c = ‘+resolvedfield_L);

57. What is The Syntax of SOQL Statement?
Answer : SELECT field1, field2,…. FROM Object_Type [WHERE condition]
Example:

List accountList =

    [SELECT ID, Name, FROM Account];

List accountList =

    [SELECT ID, Name, FROM Account WHERE annual revenue<10000]; 

58. What is Apex Interface?
Answer : Interface is a collection of unimplemented methods. This will specify the signature of the method, types of inputs that we pass the method specifies what type is given as an output.
NOTE: Generally the interface methods we give it as global.

59. What is Batch Apex in Salesforce?
Answer : Batch Apex: Batch Apex allows you to define a single job that can be broken up into manageable chunks, whereas every chunk can be processed separately.

In the Batch Apex it will fetch all the records on which you want to perform the field update and divide them into list of 200 records and on every 200 records operation is performed separately.
This would help us to execute on more than 10,000 records as, it won’t perform an operation on all the records in a single transaction instead it dividing them into Number of subtasks where each subtask may contain the records up to 4000.
Example:
If you need to make a field update of every record of account object in your organization, then we have governing limits that would restrict us from achieving the above task.
Reason: In a single transaction we can process only 10,000 records. Now in the above case if we have more than 10,000 records in the organization then we can not perform this field update.

60. What is Apex Scheduler?
Answer : It will invokes the Apex class to run at specific time.
Anybody who want to schedule their class they have to implement schedulable interface.
Schedule Interface:

The class that implements this interface can be scheduled to run at different intervals. This interface has several methods they are

Public void execute(schedulablecontext sc)

Example:

Public class mySchedule implements schedulable

{

Public void execute(schedulablecontext sc)

{

Account a = new Account(Name = ‘Faraz’)

Insert a;

}

}

Salesforce-Interview-Questions-and-Answers

61. What is the Apex Trigger in Salesforce?
Answer : Trigger is a Apex Code that executes before or after.

The following types of DML Operation:
Insert
Update
Delete
Merge
Upsert
Undelete
What are The Types of Apex Triggers in Salesforce?
Triggers Are divided into 2 types

Before Triggers
After Triggers
Before Triggers: Before Triggers can be used to update or validate values of a record before they are saved to the database.
After Triggers: After Triggers Before Triggers can be used to access field values of the records that are the stored in the database and use this values to make changes in other records.
Syntax:

Trigger trigger_name on Object_Name(trigger_events)

{

Code_block

}

WHERE trigger_events can be comma separated list of events.

62. What is Apex Managed Sharing?
Answer: Apex Managed Sharing provides developers with the ability to support an application to share a requirements.
This type of sharing available to only users with modify all data permissions. Only this users can add/change apex managed sharing.
Apex Managed Sharing uses a Sharing reason (Apex Sharing Reason)

63. GROUP BY?
Answer : With ApI version 18.0 and later /you can use group by with aggregate functions, such as sum() or max() to summarize the data and enable you to rollup query results rather than having to process the individual records in your code.

Syntax :

[ GROUP BY field GROUP BY LIST]

64. SOSL Statements In Salesforce Apex?
Answer : SOSL statement evaluate to a list of sobjects , where each list contains the search results for a particular sobject type, The result lists are always returned in the same order as they were specified in the query.

If a SOSL query does not return any records for a specified sObject type , the search results include an empty list for that sObject.

For example, you can return a list of accounts, contacts, opportunities and leds that begin with the phase map.

List < list < subject >> search list = [ find ‘map*’ In ALL FIELDS RETURNING Account (ID, Name), contact, opportunity, lead ];

Note :

The syntax of the classon Apex differs from the syntax of the FIND clause in the SOAP API.
In Apex, the value of the FIND cause is demarcated with single quotes.
Example:

FIND ‘map*’ IN ALL FIELDS RETURNING account (Id, Name], Contact, Opportunity, Lead.

In the Force.com API, the value of the FIND Clause is demarcated with braces.

For Example:

FIND {map*} IN ALL FIELDS RETURNING account [Id,name], contact ,opportunity,lead.

From search list , you can create arrays for each object returned.

Account [ ] accounts = (( list < accounts > ) search list [0] );

Contact [ ] contacts = [( list ) search list [0]) ;

Opportunity [ ] opportunities = ((list < opportunity> ) search list [2]) ;

Lead [ ] leads = (( list < lead> ) search list [3]);

65. Javascript remoting for apex controllers
Answer : Use javascript remoting in visualforce to call methods in apex controllers from javascript.
Javascript remoting has 3 parts.

The remote method invocation you add to the visualforce page, written in javascript.
The remote method definition in your Apex controller class.
This method definition is written in apex, but there are few differences from normal action methods.
The response handles callback function you add to or include in your vf page, written in javascript.

66. Adding javascript remoting to a vf page
Answer : To use javascript remoting in a vf page , add the request as a java script invocation with the following from.

[namespace.] controller.method (

[parameters….,]

Call back Function,

[configuration]

);

Name space is the namespace of the controller class
Controllers is the name of your apex controller.
Method is the name of your apex controller method you are calling.
Parameters is the comma-separated list of parameters that your method takes.
Callback function is the name of the javascript function that will handle the response from the controller.
Configuration configures the handling of remote call and response.

67. What is the main difference between using data table vs .page block table tags?
Answer : PageBlock: For default salesforce standard format.

Data table: To design custom formats

68. Which tag is used with both radio buttons and picklists to create the selectable values?
Answer : tag

69. What is Multitenant Architecture?
Answer : An application model in which all users and apps share a single, Common infrastructure and code base.

70. What is metadata – driven development model?`
Answer : An app development model that allows apps to be defined as declarative ‘blueprints”, with no code required. Data Models, objects, forms, workflows, and more are defined by Metadata.

Salesforce-Interview-Questions-and-Answers 1

71. List examples of custom field types?
Answer: Text, Pick list, Pick list (multi select), Date, Email, Date/Time, Date, Currency, Checkbox, Number, Percent, Phone, URL, Text Area, Geolocation, lookup relationship, master detail relationship etc…..

72. What is TAB in Salesforce?
Answer: Tab is a user interface component to user creates to display custom object data.

There are three type of tabs.

Custom Tabs

Visual force Tabs

Web Tabs

73. Can a user create insert their own custom logo, while creating their own custom applications?
Answer: Yes user can upload their custom logo in documents and then they choose that logo for organization.

74. List things that can be customized on page layouts?
Answer: We can customize different things on page layout like, Fields, Buttons, Custom Links and Related Lists. We can also create sections.

75. What are force platform sites?
Answer: Public websites and applications that are directly integrated with your salesforce organization without requiring users to log in with a username and password.

76. What is an AppExchange directory?
Answer: A web directory where hundreds of appexchange apps are available to salesforce customers to review, demo, comment upon, and /or install. Developers can submit their apps for listing on the appexchange directory if they want to share them with the community.

77. What are some apex classes that are commonly used within controller?
Answer: Standard controller, select option, page reference, message, etc,

78. What are the effects of using the transient keyword?
Answer: The transient keyword prevents the data from being saved in to view state. This should be used for very temporary variables.

79. What is Metadata-driven development model?
Answer: An app development model that allows apps to be defined as declarative “blueprints,” With no code required. Data model, objects, forms, workflows, and more are defined by metedata.

80. What is S-Control?
Answer: S-Controls are the predominant salesforce.com widgets which are completely based on JavaScript. These are hosted by salesforce but executed at client side. S-Controls are superseded by VisualForce now

Salesforce-Interview-Questions-and-Answers 2

81. Will Visualforce still supports the merge fields usage like S-control?
Answer: Yes. Just like S-Controls. Visualforce pages support embedded merge fields.

82. What is SOAP?
Answer: A protocol that defines a uniform way of passing XML-encoded data. SOAP Stands for Simple Object Access Protocol.

83. What is a Time Trigger?
Answer: A setting that defines when time-dependent workflow actions should fire.

84. Can a user create insert their own custom logo, while creating their own custom applications?
Answer: Yes user can upload their custom logo in documents and then they choose that logo for organization.

85. List things that can be customized on page layouts?
Answer: We can customize different things on page layout like, Fields, Buttons, Custom Links and Related Lists. We can also create sections.

86. What is a “Self Relationship”?
Answer: Self Relationship is a lookup relationship to the same object. Suppose let’s take an object “Merchandise”. Here we can create relationship in between the Account to Account (same object) object. That is called “Self Relationship”.

87. What are the main things need to consider in the “Master-Detail Relationship”?
Answer: Record level access is determined by the parent, Mandatory on child for reference of parent, cascade delete (if you delete the parent, it can cascade delete the child).

88. What is a Wrapper class?
Answer: A Wrapper class is a class whose instances are collection of other objects.
It is used to display different objects on a VF (Visual Force) page in same table.

89. What is difference insert() and database .insert() ?
Answer: Using insert method we can insert the records but if any error occurs in any record system will throw an error insertion fail and none of the records are inserted.If we want to execute partially success of bulk insert operation we will use database .insert.

90. What are Static Resources?
Answer: Using Static Resources we can upload images, zip files, jar files, javascript and CSS files that can be referred in a visual force page.
The maximum size of Static Resources for an organization is 250mB.

Salesforce-Interview-Questions-and-Answers 3

91. How to call javascript using Static Resource in Visual Force page?
Answer : Add java script file in Static Resource setup -> develop -> Static Resources -> click on ‘New’ -> Name: filename and add file from local desktop and save.
We can use that file as follows in Visual Force page

92. What is sharing rule?
Answer: If we want to give access to other users we use sharing rules.

93. Can report data be accessed programmatically?
Answer: Update for Winter ’14 API:
I think the biggest announcement that developers have been waiting for API wise is the availability of our Analytics API. We introduced a limited pilot in summer 13 and now the Analytics REST API is generally available. The Analytics API lets you integrate Salesforce report data into your apps programmatically and has several resources that let you query metadata, and record details.
Source – Winter 14 Developer Preview

94. Is there a defacto 3rd party utilities library for Apex such as Apache Commons is for Java?
Answer: Apex-lang is about as close to a Java-style library as you can get. Contains several string, database, and collection utilities that mimmick Java functionality. Be aware though, some stuff including Comparing and Sorting collections is out of date with the advent of the Comparable interface in Apex.In addition to apex-lang, and like you suggest, I typically create or reuse static helper methods throughout my projects. Static helper methods are very convenient for reusing code in Chatter functionality, DML handling, Exception handling, Unit testing, etc.

95. What are the implications of implementing Database. Stateful?
Answer: Daniel Ballinger: No, batches do not ever run simultaneously. You are correct, however, that serialization is the culprit here.
grigriforce: what’s your batch size? If you’re doing a million records, and your batch size is 1, then you will serialize/deserialize your state 1M times. Even with a small serialized object, that’s gonna hurt.

96. What are the recommended ways to refactor in Apex?
Answer: I use the second method. After refactoring, I select the ‘src’ folder, use File Search/Replace and all the changes are made and saved to the server in one go.

97. Grammar for creating an Apex parser
Answer: Keep an eye on Apex tooling api, which is used in Developer console. This is supposed to be released to public access soon.

98. Detect the current LoggingLevel in Apex
Answer: Unfortunately, I don’t think there is a way to check the current logging level in APEX.

99. Call Apex class method on the fly (dynamically)
Answer: While you can instantiate a class based on its name using the Type system class, you can’t dynamically locate a method and execute it. The best that you can do is to dynamically create an instance of a class that implements an interface and executes one of the methods on the interface.
There’s more information on the Type class and an example in the :
Apex Developer’s Guide

100. How many relationships included in SFDC & What are they?
Answer: We are having two types of relationships, they are
• Lookup Relationship
• Master-Detail Relationship

101. How can I create Many – to – Many relationships?
Answer: Lookup and Master-detail relationships are one too many relationships. We can create many – to – Many relationships by using a junction object. Junction object is a custom object with two master-detail relationships.