Monday, January 9, 2023

Salesforce Interview Questions and Answers in 2023

Table of contents

Salesforce is a cloud-based CRM or customer relationship management platform. It is designed to help businesses manage customer relationships, including sales, marketing, and customer service. It is a valuable tool for sales and marketing teams to use to nurture their leads and customers. Additionally, Salesforce can be used to develop custom applications for a business, which can automate tasks and make processes more efficient. Team coordination and communication let the business become a greater success.

Scope of Salesforce

Several companies such as Atlas, Cisco, Deloitte, Accenture, Infosys, etc, are making use of Salesforce for their CRM activities. Professionals are receiving a high pay scale and job satisfaction and the scope of the Salesforce is only said to increase over time. If you are a professional who is proficient in Salesforce and wish to progress in your career, we have compiled a list of the commonly asked salesforce interview questions that will help you land your dream job.

Top 10 Commonly Asked Salesforce Interview Questions

  • What is Salesforce?
  • Why is Salesforce important?
  • What are the features of Salesforce?
  • What are the benefits of a cloud solution such as Salesforce?
  • What is an object in Salesforce?
  • What is an Audit trail in Salesforce?
  • What is a junction object in Salesforce?
  • What are validation rules in Salesforce?
  • What causes data loss in Salesforce?
  • What is a sObject type?

The blog covers salesforce interview questions for various categories as listed below.

  • Basic Salesforce Interview Questions
  • Salesforce Interview Questions For Intermediate
  • Salesforce Interview Questions For Experienced
  • Scenario-based interview questions
  • Topic-based interview questions
    • Salesforce Fundamentals
    • Lightning Based
    • Reports and Dashboards
    • Trigger, Workflow, and Process Builder
    • Integration and Testing
    • Apex, Aura, Visualforce, and LWC
  • Salesforce FAQs

Basic Salesforce Interview Questions

This section on Salesforce Interview Questions for freshers covers questions that are commonly asked during the interview process. As a fresher, you may be new to the interview process. Learning these questions will help you answer the interviewer with confidence and ace your upcoming interview. 

1. What is Salesforce?

The graphic below demonstrates Salesforce’s power in today’s tech-savvy environment. All of them use Salesforce services and products to solve their challenges, from tech giants like Google and Facebook to your neighborhood call center.

what is salesforce

So, now let’s understand what is salesforce,

Salesforce is a cloud-based customer relationship management (CRM) software that enables organizations of all sizes to manage their customer data, contacts, sales opportunities, and cases in one central place. It also provides customizable reports and dashboards, so users can gain insights into their business. Additionally, Salesforce offers a wide range of features and integrations, making it a versatile CRM solution.

2. Why is Salesforce important?

Salesforce is important because it allows businesses to connect with their customers in a more efficient way. It also allows businesses to automate their sales and marketing processes, which can save a lot of time and money.

3. What are the features of Salesforce?

There are various features of Salesforce that include:

  • Sales Data:
    • The Salesforce CRM is helpful in getting the right sales data that helps you to make the right decisions in the business.
    • By using the Sales data, you can easily plan your next steps which can be for increasing sales and marketing with increasing productivity with accurate data.
  • Mobility: 
    • The salesforce CRM is portable as you can also use its Mobile App that will turn your smartphone into a portable sales office and you can see your dashboards anytime with the app.
    • It also gives you options to log calls, respond to new leads, and many more. 
  • File Sync and Share:
    • With Salesforce, you can easily share your files and sync them to track the content in real time.
    • Searching for files in Salesforce is easy and you can also subscribe to its alters that will give you time-to-time notifications when any changes are incorporated into the files. 
  • Sales Forecasting: 
    • Salesforce provides you to give credits to the right person and track their progress individually by using forecasts as per overlays. 
    • You can also track the journey of the leads to find out if they are interested in the deals or not. It is very helpful in sales to analyze the leads through its brilliant forecasting. 
  • Lead Management: 
    • The Salesforce app works like a fast lead converter machine that keeps you informed about the new leads and their sources. Its automatic emailing system is very helpful to reach out to your customers and boosts the revenue-generating system.
    • The lead management of Salesforce gives time-to-time updates on the contacts and also uses the sales path to understand the related documents that are needed in lead management. 
  • Contact Management:
    • Salesforce can be used to get the complete details about the customer and that data is useful to analyze if they are interested in your particular service or product. 
    • It makes contact management easy for you by providing critical data of the leads and customers and their interaction history with your products, services, etc. 
features of Salesforce

4. What are the benefits of a cloud solution such as Salesforce?

Some benefits of Salesforce are that it can help manage customer data, automate and streamline processes, and provide insights into customer behavior. Additionally, Salesforce can help sales teams increase productivity, close more deals, and improve customer relationships.

Check out the sales management course to learn how to effectively manage your sales team.

5. What is an object in Salesforce?

Objects in salesforce are considered as database tables that are used to store important data and other information about the organization. Additionally, it also provides more features to the company. Salesforce has two types of objects as follows:

  • Standard Object: These objects are already available on the Salesforce platform, including contacts, cases, leads, products, services, contracts, reports, dashboards, opportunities, etc. 
  • Custom Object: These objects can be created on the Salesforce dashboard and can be used to store other important information about an organization. Custom objects give also give you an option of data sharing. These objects include custom fields, page layouts, and a custom user interface for dashboards and reports, etc. 

6. What is an Audit trail in Salesforce?

An audit trail is helpful in tracking the changes that you and other administrators made in the Setup. This feature is very useful when there is more than one administrator in an organization. It provides you with a history of the 20 most recent setup changes that are made to your organization and you will also come to know who made these changes. This way, you will always get to know who modified the project at what time. 

The information that you get in the Audit Trail history includes the changes that are made, the person who made the changes, and the time and date when the change has been made. 

7. What is a junction object in Salesforce?

Salesforce provides various types of relationships with objects that help you to connect objects in different ways. A junction object is useful when you want to create many-to-many relationships in Salesforce. This object is useful when a normal parent-child or one-to-many relationship is not applicable. They can be created by custom objects and then relating these objects with two relationships such as master and detail relationships. It becomes important when you are modeling specific data schemas in Salesforce. For example, a platform StudySolutions works like a junction object as it stores many-to-many relations between the study object and the solution object. However, the relation between the study object and the solution object is a junction relationship in Salesforce. 

8. What are validation rules in Salesforce?

The validation rules in Salesforce are helpful to enforce the integrity constraints of the data. In the validation rule, we give several conditions in the formula editor such that if a condition fails, Salesforce goes to check another condition, and so on. In case, if all the conditions are failed it saves the record and shows a proper error message. 

Salesforce allows you to create validation rules for the objects, campaigns, users, projects, and fields. For example, if a user is trying to make changes to the restricted fields, then it will give him an appropriate error message and only allow when the validation of an administration or authenticated person is done. 

These rules consist of some formula or conditions that evaluates the data in more than one field in the records to specify if the user meets the required details or not. 

9. What causes data loss in Salesforce?

There can be several reasons for data loss in Salesforce that including:

  • Integration Errors: These errors can be one of the reasons for data loss in salesforce and they can occur when companies are integrating internal systems and applications with Salesforce like marketing tools and others. The changes to default configurations result in unexpected behavior of the platform causing data loss or corrupted data. 
  • Migration Errors: Migrations are very helpful for moving a huge amount of data somewhere else. To carry out migrations, it becomes important to consolidate the data and make complex transformations that increase the risk of data loss. 
  • Human Error: Accidents can happen anytime and anywhere. It is more often the reason for data loss is a human intervention with the data. Having more than one administrator can also cause data loss as all the admins have the same permissions to access the data and any change done by one administrator may lead to data loss. 

10. What is a sObject type?

SObjects are the standard or custom objects that store the data in the database. A single sObject variable shows a row of data that can be declared with the help of Apex by the use of the SOAP API of the object. 

For example:

Acc x = new Acc();
CustomObject CO = new CustomObject();

This is very similar to SOAP API and the apex allows the use of generic sObject to represent any object. The new operator that we used in our code still requires the type of sObject and therefore all instances should be specific to sObjects. 

For example:

sObject x = new Custom();

11. What is an Apex transaction?

Apex transaction is used for the representation of a set of operations. These operations are executed as a single unit and all these operations are either completed successfully or not. This is because the entire transaction in Apex is rolled back and if any error occurs in even a single operation, then no data is committed to the database. The operations that come inside the transaction boundary do represent only a single unit of operation. The apex transactions ensure the integrity of data as the code runs as a part of atomic transactions in Apex. 

All the DML operations in Apex Transactions represent a single unit only and this also applies to the calls that are made from the transaction boundary for the external code. 

12. What is the difference between the public and global classes in Apex?

The difference between the public and global class in Apex is as follows: 

Public ClassGlobal Class
1. The method defined in a public class can be used by any Apex in the application. 1. The method defined in a global class can be used by any Apex that has access to the class. 
2. When you declare the method as public, it is not necessary to declare the glass that contains it as public.2. When you declare a method as global, you also need to declare the class that contains it as global.
3. The access modifier should be referenced anywhere in the application. 3. The access modifier should be used for any method outside of the application.

13. What are getter methods and setter methods?

Getter methods: Whenever a name variable is called, this method returns a value of that variable to the visualforce page in the Apex. Getter methods invoke the get method of that variable and for better understanding let us have a look at the example below:

<apex:outputlabel>{!value}</apex:outputlabel>

In this example, the value variable is used by the visualforce page when it is declared in the class.

  • Setter methods: The values from the visualforce page are taken by the setter methods and stored in the Apex variable name. To better understand this method, let us have a look at the example below:
public class setterMethod{
public string value;
public string getvalue(){
return value;
}
public void setValue(string value){
this.value = value;
}
}

In the above example, the visual force page will try to take the value from the code and save the values to the apex variables. 

14. Give an example of a custom App you could build on the Salesforce platform.

Salesforces enables you to take customizations a level further by allowing us to build custom applications on the platform. Sales & Service Clouds are set up with various features that have been designed for this specific purpose. A few examples are:

  • Goal setting applications to help managers track their team’s targets and goals
  • HR application to allow internal teams or recruiters to manage job applications
  • Finance systems to help with tracking of invoices and payments

15. What is the difference between data and metadata in Salesforce?

Data – The records that a business relies on. Such as accounts, contacts, users, etc.

Metadata – The data that describes other data. It is related to the fields, code, configurations, page layouts, and logic that go into building the look of the salesforce environment.

Salesforce Interview Questions For Intermediate

This section of the blog covers questions for professionals who already have some experience of Salesforce but are looking to brush up their knowledge and prepare for an upcoming salesforce interview.

16. Explain the skinny table. What are the considerations for the skinny table?

Skinny tables are useful when we want to access the fields which are most frequently used to avoid the joins. Skinny tables improve the performance of specific operations that are read-only types and these operations can be list views and reports. These tables sync with the source tables whenever any source table is modified and that’s the reason they are highly effective. 

In order to use skinny tables in your Salesforce account, you are required to contact Salesforce customer support. Because you cannot create these tables by yourself. Therefore, you need to contact the customer support of Salesforce to create these skinny tables. 

The considerations for the skinny table are as follows:

  • The table cannot hold values from other objects.
  • Skinny tables are only capable of containing only 100 columns at most. 
  • These skinny tables can be easily copied to the full sandbox of your organization. 

17. What is Future annotation(@future)?

  • When we want to specify the methods that are executed asynchronously, future annotations come into view. And the use of future annotations is very helpful in specifying methods. 
  • The method that is specified with @future annotation, is executed only when all the required resources of salesforce are available. 

The syntax for using Future annotation is as follows:


global class nameOfClass
{
@future
static void nameOfMethod(arguments/parameters)
{
//method definition here
}
}

18. What are the different types of email templates available in Salesforce?

  • The different types of email templates in Salesforce are as follows:
  • HTML with letterhead: These types of email templates are accessible to only administrators and users with permission of “Edit HTML Templates” based on the letterhead.
  • Custom HTML: These email templates can be created by users and administrators with the permissions of “Edit HTML Templates” by using a letterhead. 
  • Text: These email templates are accessible to everyone in the organization and all the users are allowed to modify or create these templates. 

19. Can you give an example of a Salesforce API and its usage?

  • There are several APIs provided by Salesforce for the developers to interact with the system in several ways. Some of them are:
  • Bulk: This API is used to get programmatic access to load and query a huge amount of data into the Salesforce organization. 
  • REST: The REST API can be easily integrated with Salesforce by using the HTTP methods in any of the formats- XML or JSON. REST API works as an ideal API for the development of mobile applications and clients outside of the organization. 

For example, if you are required to retrieve some data about the version of Salesforce, then you need to submit a request by using the following code:

curl https://<Instance>.salesforce.com/services/data

in the above code, you are required to replace the instance with the instance of your organization. 

And the output from the above code is as follows:

[
{
“label”: “Weather ‘11”,
“url” : “/services/data/v20.2”,
“version” : “20.2”
}
…
]

20. What are custom labels in Salesforce? What is the character limit of the custom label?

The custom labels in Salesforce are the labels used by developers for developing multilingual applications. These applications are used for the representation of the information to the users in their native languages. Custom labels are very useful to work with customized values as it allows users of different languages to access the information in that application. 

In Salesforce, you can create up to 5000 custom labels in which the character limit of a single custom label is 1000. However, if the custom labels are created from managed packages, then it doesn’t count under this limit. 

21. What is an attribute tag? What is the syntax for including them?

The attribute tag is used to store the information that is to be referenced with the lightning component of the code. Attributes on components work just like the instance variables in objects.

The syntax for including attribute tags is as follows:

1
<action:attribute>

In the above syntax, in place of action, you can give another name to the attribute tag for including it. 

22. What are the three types of bindings used in Visualforce? What does each refer to?

In Visualforce, we have three types of bindings such as:

  1. Data Bindings: This binding refers to the data set in the controller.
  2. Component Bindings: Visualforce components are referred to by the component bindings.
  3. Action Bindings: The action methods are triggered by action bindings in visualforce. 

23. What are the different types of collections in Apex? What are maps in Apex?

Collections in Apex are the composite data types that permit the developers to combine or collect multiple types of data into a single variable. There are three different types of collections in Apex such as List, Map, and Set.

  • List: A list is an ordered collection of elements that can be distinguished by their indices. 
  • Map: Maps are also known as ‘Key/Value” pairs which mean maps are collections with the index values having specific keys for each index number. 
  • Set: Sets are just like lists where they have a collection of elements but the only difference is that the elements are unordered in sets.  

24. How can you embed a Visualflow in a Visualforce page?

There are some steps that you need to perform to embed a visual flow in a Visualforce page:

  • Go to Setup, then find the Flows in Quick Find Box and then select Flows. 
  • Click on the name of the flow and copy the API’s name.
  • Now, again from Setup, enter the Visualforce pages and click on define a new visual force page. 
  • Add the <flow:greatlearning> component at some place between the <apex:page> tags.
  • Now you need to set up the name of your Visualflow:
  • Click Save.
  • If you want to restrict this visual flow to some users, then you can do this by going to the security of visualforce pages and enabling the profiles by adding them to them. 
  • Lastly, you need to add the visual force page to your application by the use of a custom link or a button. 

So, these were the steps that should be followed to add a Visualflow to Visualforce pages. 

25. What are the different methods of batch Apex class?

There are three different methods of Batch Apex Class in Salesforce:

  • Start Method: This method is called at the beginning of the apex job. This method is called once and returns Database.QuerLocator or variables, records, objects that passed to the job. 
  • Execute Method: It is called for each batch of records that are passed to the job. The default batch size for executing the method is 200 records and the maximum number of records it can take up to is 2000 records. There is no guarantee that all the records will execute in the order they are received from the start methods.
  • Finish Method: The finish method is used for the execution of post-processing operations such as sending an e-mail. This method is called after all the batches are processed. 

Salesforce Interview Questions For Experienced

This part of the blog on Salesforce Interview Questions covers questions that experienced professionals may face in their upcoming interview process. It has a list of the commonly asked questions for you to be better prepared.

26. Why are Visualforce pages served from a different domain?

  • The only reason behind the visual force pages being found on different domains is Security. In order to keep control over customizable and non-customizable things, Salesforce keeps Visualforce pages on different domains. 

27. What are WhoId and WhatId in activities?

  • WhoID is used for people’s things and it uses Lead ID or contact ID in activities.
  • WhatID is used for things that are objects and it takes Account ID or an Opportunity ID for reference in activities. 

28. Can you have a roll-up summary field in case of a Master-Detail relationship?

  • You can have a roll-up summary field for the Master-Detail relationship in Salesforce, but the lookup relationship is not well to have a roll-up summary. Roll-up summary fields are useful when we want to show a value in master records depending on the values of a set of fields in our detail records. But the detail records must be related to the master-detail relationship. There are four calculations that you can perform by using a roll-up summary such as counting the total number of detail records, sum, and finding the minimum or maximum value. 

29. What are the examples of non-deterministic Force.com formula fields?

  • The examples of non-deterministic force.com formula fields include the following:
  • Fields that have dynamic data function in them such as TODAY() or NOW()
  • Lookup Fields
  • The formula fields work as a reference for other entities. 

30. How can we implement pagination in Visualforce?

  • For the implementation of pagination in Visualforce, we do have two options such as- OFFSET and StandardSetController pagination. 
  • Let us see OFFSET Pagination first:
  • Visualforce:
<apex:page controller= “OffsetPaginationController”>
<apex:form>
<apex:pageSection id = “ps” title= “accountNumber”>
<apex:pageSectionTable value = “{!accountNumber}” var = “c” id = “pst”>
<apex:column value = “{!c.userName}” />
<apex:column value = “{!c.userContact}” />
</apex:pageSectionTable>
<apex:commandClick value = “firstButton” action = “{!frstbtn}” disabled= “{!prev}”
 reRender = “pd, pb”/>
<apex.commandClick balue = “prevButton” action = “{!prevbtn}” disabled = “{!prev}” 
reRender = “pt, pb” />
<apex.commandClick value = “nextButton” action = “{!nxtbtn}” disabled = “{!nxt}” 
reRender = “pt, pb” />
<apex.commandClick value = “endButton” action = “{!endbtn}” disabled = “{!nxt}”
 reRender = “pt, pb” />
</apex:pageSection>
</apex:form>
</apex:page>

Controller:

public class OffsetPaginationController{
public List<accountNumber> 1staccountNumber;
public Integer totalRecordsCount (get;set;)
public Integer sizeOffset = 0;
public Integer limitOfQuery = 10;
public OffsetPaginationController(){
1staccountNumber = new List<accountNumber>();
totalRecordsCount = [SELECT count() FROM accountNumber];
}
public List<accountNumber> getaccountNumbers(){
1staccountNumber = [SELECT Id, userName, Contact FROM userContact ORDER BY 
userName LIMIT: QueryLimit OFFSET: sizeOffset];
return 1staccountNumber;
}
public Boolean getprev(){
if(sizeOffset > 0)
return false;
else
return true;
}
public Boolean getnext(){
if(sizeOffset + queryLimit < totalRecordsCount)
return false;
else
return true;
}
public PageReference  nxtbtn(){
sizeOffset += queryLimit;
return null;
}
public PageReference prevbtn(){
sizeOffset -= queryLimit;
return null;
}
public PageReference frstbtn(){
sizeOffset = 0;
return null;
}
public PageReference endbtn(){
sizeOffset = totalRecordsCount – math.mod(totalRecordsCount, queryLimit);
return null;
}
}

  • Let us now see the StandardSetcontroller Pagination

Visualforce:

<apex:page controller= “OffsetPaginationController”>
<apex:form>
<apex:pageSection id = “ps” title= “accountNumber”>
<apex:pageSectionTable value = “{!accountNumber}” var = “c” id = “pst”>
<apex:column value = “{!c.userName}” />
<apex:column value = “{!c.userContact}” />
</apex:pageSectionTable>
<apex:commandClick value = “firstButton” action = “{!ssc.frstbtn}” 
disabled= “{!!ssc.hasprev}” reRender = “pd, pb”/>
<apex.commandClick balue = “prevButton” action = “{!ssc.prevbtn}” 
disabled = “{!!ssc.hasprev}” reRender = “pt, pb” />
<apex.commandClick value = “nextButton” action = “{!ssc.nxtbtn}” 
disabled = “{!!ssc.hasnxt}” reRender = “pt, pb” />
<apex.commandClick value = “endButton” action = “{!ssc.endbtn}” 
disabled = “{!!ssc.hasnxt}” reRender = “pt, pb” />
</apex:pageSection>
</apex:form>
</apex:page>

Controller:

public class OffsetPaginationController{
public List<accountNumber> 1staccountNumber;
public Integer totalRecordsCount (get;set;)
public OffsetPaginationController(){
1staccountNumber = new List<accountNumber>();
size = 10;
}
public ApexPages.StandardSetController ssc{
get{
if(ssc == null){
String resultOfQuery = ‘SELECT Id, userName, userContact from Contact ORDER BY Name’;
ssc = new ApexPages.StandardSetController(Database.getQueryLocator(resultOfQuery));
ssc.setPageSize(size);
totalRecordsCount = ssc.getResultSize();
}
return ssc;
}
set;
}
public List<accountNumber> getaccountNumbers(){
return (List<accountNumber>)ssc.getRecords();
}
}

31. Explain the term “Data Skew” in Salesforce.

Data Skew is a condition in Salesforce where the large dataset is distributed unevenly. This condition occurs when there are more than 1000 records of child object that relates to only a single parent object in that record. 

32. How can you call a controller method from JavaScript?

After the loading of the page is completed, the action parameter calls the method. In a specific scenario the following JavaScript code can be used to call the controller method:

<apex:page StandardSetController = “acc” extensions = “orderController”>
<script src= “//ajax.googleapis.com/ajax/libs/jquery/1.09.5/jquery.min.js”></script>
<script>
window.$j = jQuery.noConflict();
$j(document).ready(function(){
orderController.openPage(function(result,event){
console.log(result);
window.open(result, “_slf”);
});
});
</script>
</apex:page>
public class orderController{
//
@remoteAction
public pageReference openPage(){
pageReference newpage = NEW pageReference(‘/apex’ + ‘/openpage’ + ‘?aid=’ + a.id);
openordercontrollerembed.setRedirect(false);
return openordercontrollerembed;
}
}

Scenario-Based Interview Questions

In this interview, the interviewer presents an imaginary situation where there is a requirement and asks you to solve it in as many different ways as possible. It will primarily be based on process builders, triggers, and workflows. The topic can also be based on creating new objects, data-loaders, and creating relationships. So if the company is known for scenario-based questions, you must prepare for all these topics thoroughly. 

33. Whenever a case is created with origin as Phonethen set status as Newand Priority as High.

Answer: Object: Case

Trigger: Before insert

Code:

trigger CaseOrigin on Case (before insert) {
 for(case c : trigger.new){
     if(c.origin == 'Phone'){
          c.status = 'New';
          c.priority = ’High’;
         }
     }
}

34. Whenever Lead is created with LeadSource as Local then give rating as cold otherwise hot.

trigger LeadScenario on Lead (before insert) {
for(lead ld : trigger.new){
if(ld.leadsource == ‘Local’)
 {
  ld.Rating = 'Cold';
 }
else{
ld.Rating = 'Hot';
   }
 }
}

35. Is Test.startTest() and Test.stopTest() required in a test class?

Answer: Test.startTest() and Test.stopTest() exist primarily to allow you to reset the governor limits within the context of your test execution and to be able to test asynchronous methods. These two statements cannot be called more than once within a testMethod. They are not required to be used but in some situations may be critical. 

36. Let’s say a user does not have permission on a child object and is having permission on the parent object to read/create/edit/delete the parent object, If there is a trigger on the parent object to insert a child record after the parent record is created, will it create a child record or not after the user insert parent record manually?

Answer: Yes, a child record will be created.

37. You are having a requirement to pass value from child component to parent component which type of event you will use?

Answer: Component events are used in cases where there is a relationship between two components. Component Events are fired by the child components and handled by the parent component.

38. Suppose we have a requirement to create an account using a new button and some default values in the new account screen. How can we achieve this requirement?

Answer: We can make use of force:createRecord; it is an event that opens a page to create a record for a specific entity. 

Sample syntax:






createRecord : function (component, event, helper) {
    var createRecordEvent = $A.get("e.force:createRecord");
    createRecordEvent.setParams({
        "entityApiName": "ObjectApiName"
    });
    createRecordEvent.fire();
}

39. There is a profile by name ReadAccessProfileand two users User1 and User2 have been assigned to it. There is an object X. I want to have ReadWrite access for User1 and ReadOnly access for User2 for object X. How can this be accomplished?

  1. Step 1: Read Access for both users is common hence in the Profile settings give ‘Read’ access for the object ‘X’. By doing this User U2 will be able to read all the records( One condition satisfied) but User1 will only be able to read the records (Second condition not satisfied).
  2. Step 2: So next what we do is we create a permission set say ‘GrantWriteAccess’ and in this permission set we give the object ‘X’ the Write access and assign the user User1 to this permission set. (Second condition satisfied).

Answer: Scenario 1: If the two objects are new and there are no records in each. Then we can create a Master-detail relationship by creating the field in Setup.

Scenario 2: If the two objects exist prior to this requirement and have records. If this is the scenario then we should first create a lookup relationship between the two objects and make sure that all the values are filled and then convert the relationship to master-detail from lookup.

41. The requirement is to delete a set of records and dont want them to be stored them in the recycle bin as well. What are my options?

Answer: This can be done using the Hard Delete option. It can be done in the apex by calling emptyRecycleBin().

42. In the before Insert event trigger which context variable is correct Trigger.new or new Trigger.newmap?

Answer: As the event is before insert only trigger.new will be supported.

Trigger.newmap will not be supported as we do not have an id of the record before the record is inserted.

Topic-Based Interview Questions

In this type of interview, the interviewer will ask you questions from all the sections of Salesforce you are familiar with. Keep in mind if you do not have expertise in some areas, do inform the interviewer honestly. Show interest in learning but never bluff. The interviewer is probably a person with years of experience and will know if you are bluffing or not. The most common topics will be around:

  1. Salesforce fundamentals
  2. Lightning Based
  3. Reports and Dashboards
  4. Trigger, Workflow, and Process Builder
  5. Integration and Testing
  6. Apex, Aura, Visualforce, and LWC

A. Salesforce Fundamentals

43. What is the difference between profile and role? Can a user be assigned two profiles?

Answer: A Salesforce profile controls the following key aspects pertaining to Salesforce:

  • Field Level Security – Here, the users are restricted to creating, reading, editing, and deleting fields according to specific requirements.
  • Page Layouts – This restricts the page layouts a Salesforce user is permitted to see.
  • Custom Apps – This restricts all the custom and standard apps that can be viewed and accessed by a Salesforce user.
  • Record Types – This restricts the record types available to specific Salesforce users.
  • Login – This restricts the login hours of Salesforce users onto the platform based on specific requirements.
  • Tabs – This restricts the tabs that can be accessed and viewed by Salesforce users.

There are two major types of user profiles in Salesforce – standard profiles and custom profiles. While a standard profile is already provided by Salesforce, a custom profile can be created by the users based on their specific requirements.

44. What are governor limits in Salesforce?

Answer:  As we all know, Salesforce is on a shared (multi-tenant) platform which means the whole resource is shared with everyone who is a client/customer of Salesforce. This requires Salesforce to enforce some limits of the resource used by each client/customer. These rules are referred to as Governor Limits. These limits are different according to the license or version the client/customer has purchased/ subscribed to. 

The governor rules limit:

  1. Per-Transaction Apex Limits
  2. Per-Transaction Certified Managed Package Limits
  3. Force.com Lightning Platform Apex Limits
  4. Static Apex Limits
  5. Size-Specific Apex Limits
  6. Inbound Email Limit
  7. SOQL and SOSL Governor Limits in Salesforce
  8.  Notification Push Limit
  9. Api request limits

45. Can you edit an apex trigger/ apex class in the production environment? Can you edit a Visualforce page in the production environment?

Answer: No, you cannot edit and apex trigger or class in production. You need to make the changes in the dev environment and then deploy it using the deployment tools.

46. What is a sandbox and what are the different types of sandboxes?

A sandbox serves as a copy of the production environment where the developers and testers can create and test new features and configuration changes without affecting the data or settings of the production environment.

There are 4 types of sandboxes:

  1. Developer (200MB storage, refreshes daily, Used for developing)
  2. Developer Pro (1GB storage, refreshes daily, Used for integration testing)
  3. Partial Copy (5GB storage, refreshes every 5 days, Used for the end-end test)
  4. Full (The same size as Production, refreshes in 28 days, Used for UAT testing)

47. What is a standard profile and name some of them?

Answer: A standard profile is a profile assigned to the users by Salesforce. These profiles cannot be deleted and need to adhere to the Salesforce permission sets assigned to them.

Some of the major standard profiles are:

  1. System Administrator
  2. Standard User
  3. Marketing User
  4. Solution Manager
  5. Read-only
  6. Contract Manager

48. What are the different types of relationships in Salesforce? Can you differentiate between them?

Answer: Relationships depict how two objects are related to each other. Salesforce allows the following relationships:

  1. Master-detail relationship
  2. Lookup relationship
  3. Many to many relationships
  4. Self-relationship
  5. External relationship

Master-detail relationship: In this relationship, one object acts as the master or controlling object and the other object acts as the detail or the controlled field. When the master object record is deleted the detail records get deleted along with it.

The master record is required on the detailed record. It is a tightly bound relationship. We can only assign two master-detail relationships per object. We can only create a roll-up summary field on this relationship.

Lookup relationship: In this relationship, the objects are loosely coupled. The object doesn’t get deleted if the other object is deleted. Parent and child records have their own sharing and security settings. The lookup relationship is not mandatory by default. We can assign up to 40 lookup relationships per object.

Many to many relationships:  There is no such relationship as many to many but we can create it by adding two master-detail relationships to a common object. The common object is also known as the Junction object.

Self Relationships: A self-relationship is a relationship with the same object. This can be explained better with an example: A account is related to a parent account.

External Relationships: It is a new relationship that was introduced with Salesforce Connect. We use this relationship to link an external object to another external object. It supports Standard lookup relationships that use 18 characters Salesforce Id for the association.

49. What are SOQL and SOSL? What are the differences?

Answer: SOQL (Salesforce Object Query Language) is used to construct simple and powerful query strings in the queryString parameter in the query() call, in Apex statements, triggers, in Visualforce controllers and getter methods, or in the Schema Explorer of the Force.com IDE. It is similar to SQL with features to query Salesforce objects directly. It can only search one object at a time. It returns records on which DML operations can be performed

SOSL ( Salesforce Object Search Language)  is used to construct text searches in the search() call, in Apex statements, in Visualforce controllers and getter methods, or the Schema Explorer of the Eclipse Toolkit. It can be used to search for multiple objects at one time. It cannot be used in triggers. It returns fields as results. DML operations cannot be performed on these results.

50. What is the difference between permission sets and sharing rules?

Answer: A Permission Set is a collection of settings and permissions that give users access to various tools and functions. Permission sets extend users’ functional access without changing their profiles.

Sharing rules are used to extend sharing access to users in public groups, roles, or territories. Sharing rules give particular users greater access by making automatic exceptions to your org-wide sharing settings.

51. What are the different ways to deploy to production?

Answer:  The different ways to deploy to production are:

  1. Change Sets
  2. Eclipse with Force.com IDE (Deprecated)
  3. Force.com Migration Tool – ANT/Java based
  4. Salesforce Package
  5. VSCode Salesforce Extension Pack
  6. Salesforce Code Builder

52. What is the minimum test coverage required to deploy to production?

Answer: The minimum test coverage required is 75% to deploy to production. If this is not satisfied then the apex class or trigger cannot be deployed to production.

B. Lightning Based

53. What does the lightning component bundle contain?

Answer:  

The lightning component contains the following:

  1. Component
  2. Controller
  3. Helper
  4. Style
  5. Documentation
  6. Renderer
  7. SVG
  8. Design

54. Name the different lightning component models?

Answer: 

The two lightning component models are 

  1. Aura Component Model
  2. Lightning Web Component Model

55. What is Lightning App Builder?

Answer:

The lightning app builder is used to create lightning pages for the Salesforce Lightning experience and mobile apps. The Lightning App Builder is a point-and-click tool. Lightning Pages are built using Lightning components which are compact, configurable, and reusable elements that can be dragged and dropped into different regions of the page in the Lightning App Builder. It is very useful and easy to use.

We can use it to create:

  1. App Page
  2. Home Page
  3. Record Page

56. Which language does the Lightning component use on the Server side and Client side?

Answer: Lightning Component uses Javascript on the client side and Apex on the server side.

57. What are the tools used in Lightning?

Answer:

  1. Lightning App Builder
  2. Lightning Connect
  3. Lightning Schema Builder
  4. Lightning Process Builder

58. What are the advantages of using Lightning?

Answer:

  1. Better Performance
  2. Out-of-the-box component set
  3. Faster development
  4. Multiple device and cross-browser compatibility
  5. Event-driven architecture
  6. Rich component ecosystem

59. Is there a limit to having lightning components in one application?

Answer: No, there is no limit to having lightning components in one application.

60. Where can we use Lightning Components?

Answer: We can use lightning components as:

  1. Drag and drop components in Lightning App Builder and Community Builder
  2. Quick Action buttons
  3. Lightning pages
  4. Lightning Record pages
  5. Stand-alone Apps
  6. Overriding standard actions

61. How can we assign Lightning Pages?

Answer: Lightning pages can be assigned in three ways:

  1. The org default
  2. App default
  3. App, record type, profile

62. What kind of framework does Lightning use?

Answer: Lightning uses a Component based framework.

C. Reports and Dashboards

63. What are the different types of reports?

Answer:  Different types of reports are:

  1. Tabular Reports (Basic type of report)
  2. Summary Reports (Grouping by rows and sorting)
  3. Matrix Reports (Grouping by rows and columns )
  4. Joined Reports (can contain reports from different report types)

64. What is a bucket field?

Answer:  A bucket field is a field that helps in categorizing records in a report. It can be used as any other field to sort, filter or group your report.

65. What is the difference between Standard and Custom reports?

Answer: Standard reports are created by Salesforce when we create objects and relationships. Custom report fields can be specified by the admin. We can also associate up to 4 objects.

66. What is a dashboard?

Answer: Dashboard can be simply put as a graphical representation of reports which can be tailored to a user and can also be set to a standard representation that is the same for all users. Dashboards can have up to 20 components. Dashboards show data according to the last run report.

67. What is a dynamic Dashboard?

Answer: Dynamic dashboards are used to display details according to the user’s security settings. It does not refresh on its own. It refreshes when the page is refreshed. Dynamic dashboards help to show data that is specific to that user and the data to which he has access.

68. How many records can we display on a single page in a report?

Answer: Salesforce allows us to display 2000 records on a page. If we need to show more records then the option is to export them into an excel file.

69. Can we create formula fields in Reports?

Answer: Yes formula fields can be used in all the other types of reports except Tabular. The formula should be in currency, percent, or number type.

70. What kind of reports can be used to generate dashboards?

Answer: Summary and Matrix reports are used to generate dashboards.

71. Is it possible to delete reports using a data loader?

Answer: No, it is not possible to delete reports using a data loader.

72. What is not supported in Joined reports?

Answer: 

  1. Bucket fields
  2. Cross filters
  3. The rows display filters.

D. Trigger, Workflow, and Process Builder

73. What is a Trigger? Name the different types.

Answer: Apex triggers allow us to perform custom actions before or after events to records in Salesforce, such as insertions, updates, or deletions. We use triggers to perform tasks that can’t be done by other point-and-click tools in Salesforce UI. There are two types of Triggers:

  1. Before Triggers (insert, update, delete)
  2. After Triggers (insert, update, delete, undelete)

74. What is a process builder? Why do we use it?

Answer: Process builder is a simple-to-use workflow tool to automate your business process. It provides a simple graphical representation that depicts the process. Process builder can be used to 

  1. Create a record
  2. Update the record
  3. Launch a flow
  4. Send an email
  5. Post to chatter
  6. Submit for approval
  7. Can do what all a workflow can do except for outbound messages

75. What is a workflow? What actions can be performed using it?

Answer: A workflow is an automation tool used to do simple tasks such as 

  1. Assigning a new task 
  2. Email Alerts
  3. Outbound messages
  4. Field Updates

76. What is an approval process? 

Answer: The approval process is used to provide the user with a step-by-step guide to approve a certain process. We can configure to send an email, create a task, etc when the approval process reaches a certain step process. The approval process consists of the following steps:

  1. Process definition
  2. Initial submission actions
  3. Step definitions
  4. Final Rejection actions
  5. Final Approval actions

77. What is a recursive trigger and how can we avoid it?

Answer: Recursive trigger is a situation where the actions of the trigger invoke the same trigger and it goes on in a loop. To avoid this scenario a simple step is to create a static variable and check the state of the variable before executing the trigger.

78. How is process builder and flow builder different?

Answer: Simply put the process builder is designed to be a simpler tool. It is much more linear in the process as compared to Flow builder. Flow builder is much more powerful not only in terms of the process design but also actions. Flow builder has a delete functionality along with being able to update multiple records. It is true that process builders are also able to update multiple records but it is limited to updating only child records of the parent record which started the process.

79. What are the conditions which need to be specified when we need to schedule actions?

Answer:  There are two conditions that need to be specified:

  1. Only when the record is created
  2. When a record is created or edited and defined criteria are met

80. What is a queue?

Answer: A queue is used to hold a predefined set of objects and users. Anyone in the queue can pick up a task assigned to the queue and can complete it. A queue can contain users, public groups, partner users, roles, roles, subordinates, etc.

81. What are context variables and how do we use them?

Answer: Trigger Context variables (TCV) can be defined as those variables which help us in tracking the runtime information of the current execution of a trigger. Some of them are:

  1. isExecuting: This variable returns the value true if the current context for the Apex code happens to be a trigger and does not happen to be a Visualforce page, a Web service, or an execute anonymous() API call.
  2. isInsert: This variable returns the value true if the trigger executed is an insert operation
  3. isUpdate: This variable returns the value true if the trigger executed is an update operation
  4. isDelete: This variable returns the value true if the trigger executed is a delete operation
  5. isBefore: This variable returns the value true if the trigger was fired before any record was saved
  6. IsAfter: This variable returns the value true if the trigger was fired after all record was saved
  7. isUndelete: This variable returns the value true if the record was recovered from recycle bin
  8. new: This variable returns the list of the new versions of the sObject records. This is only available in the insert, update and undelete triggers.
  9. newMap: This returns the list of Ids of the new version of the sObject records
  10. old: This variable returns a list of all the old versions of the sObject records. This is only available in update triggers and deletes triggers
  11. oldMap: This variable returns the list of Ids of the old versions of the sObject records
  12. size: This variable returns the total number of records invoked by the trigger 

82. What is the order of execution of Trigger, Process Builder, and workflow?

Answer:  The order of execution is Trigger => Workflow => Process Builder

E. Integration and Testing

83. What is Integration? Explain.

Answer: Integration is connecting two applications. An enterprise uses a lot of applications that are not designed or created to work with each other. Integration helps the enterprise in getting the best efficiency, consistency, and quality of all the applications working together. Each application can have different business logic, data, and security layers which all need to be integrated.

84. What are the different ways to integrate into Salesforce?

Answer: There are 3 different ways to integrate into Salesforce:

  1. User interface integration: Combine the UIs of two or more apps to create composite apps with little or no rework on the UI of each individual app.
  2. Business Logic Integration: Apex Web Services is used for Inbound and Apex Callouts for Outbound. It typically handles a scenario where business logic is spread across several applications to implement the complete end-to-end business process.
  3. Data Integration: SOAP APIs and REST APIs are used here. It typically handles data synchronization requirements, where one application in an enterprise acts as the primary source for a particular business object, like an Account.

85. How many APIs are available in Salesforce?

Answer: They are 11 different APIs. They are:

  • REST API
  • SOAP API
  • Bulk API
  • Streaming API
  • Metadata API
  • Chatter REST API
  • User Interface API
  • Analytics REST API
  • Apex REST API
  • Apex SOAP API
  • Tooling API

86. What are webservices?

Answer: Webservices is a functionality that helps us to do integration. Web services are open standard (XML, SOAP, HTTP, etc.) based web applications that interact with other web applications for the purpose of exchanging data. Web services can convert your existing applications into web applications.

87. What is JSON?

Answer: JSON (Javascript Object Notation). JSON is lighter than XML. When transferring data between two communication channels it needs to be in Text, JSON is text and can be converted to Javascript and vice-versa with ease. JSON is then used to send messages between servers.

88. Why do we need test classes in Salesforce?

Answer: Test classes are used to write unit tests for Apex classes and triggers in salesforce. We need to write test classes that have more than 75% code coverage of the apex class and triggers. When we need to deploy apex classes or triggers in production we need to upload the test classes along with it. If the test classes fail to cover 75% of the code then deployment fails.

89. Syntax of a simple test Method?

Answer: 

1
2
3
4
5
6
7
@isTest
private class MyTestClass { 
   static testMethod void myTest1() {
   }
   static testMethod void myTest2() {
   }
 }

90. What are assert statements and why are they used?

Answer:  Assert statements are used to compare what the real value is and what the expected value is. There are 3 types of assert statements:

  1. system.assertEquals(val1,val2)
  2. system.assertNotEquals(val1,val2)
  3. system.assertEquals(val1> val2)

91. What is seeAllData?

Answer: The test classes cannot recognize the data in the database by default and hence we need to mention the @isTest(seeAllData=true)  so that it recognised the data in the database.

92. What all needs to be tested in Apex?

Answer: Salesforce recommends we test :

  1. Single records
  2. Bulk records
  3. Positive scenarios
  4. Negative scenarios
  5. Restricted User

F. Apex, Aura, Visualforce, and LWC

93. What is LWC? What does a Lightning Web component bundle contain?

Answer: LWC is a new programming model to help developers build Lightning components for Salesforce. It makes use of Javascript more and does not use Apex making it easier for developers with javascript knowledge to build components in salesforce without any apex knowledge. It is much faster and lighter as it uses Javascript. The lightning component bundle contains :

  1. HTML
  2. Javascript
  3. XML 

Files by default when we create a new LWC component. We need Salesforce CLI to work with LWC. 

94. Difference between imperative and wired apex methods

Answer:  

Wired apex methods- are called every time the page refreshes or the reactive properties are changed. Data returned is immutable. We can only perform Read query operations using wired apex methods. We need to use @wired in front of the function name. If we want to refresh then we have to call refreshApex().

Imperative apex methods – need to be called explicitly. Data returned is mutable. We can perform DML operations on imperative operations.DML operations cannot be done if the apex method is annotated with cacheable=true. It is invoked as promises inside a function.

95. What are @api and @track? When do we use each?

Answer: @api is used if we need to make the property or function to be public. @track was used to make it reactive but since Summer 19 release all properties are reactive by default. Now @track is used to re-render arrays or objects as it does not render by default if one element of the array is changed or the object’s property is changed.

96. Can we use Aura inside an LWC and vice-versa? 

Answer: No, we cannot use Aura inside an LWC but the opposite can be done i.e we can use LWC inside the Aura component. We can also use LWC inside flows, page components, etc.

97. Name some data types used in aura components?

Answer: 

  • String
  • Integer
  • Boolean
  • Decimal
  • Double
  • Long
  • DateTime
  • Date
  • Array
  • List
  • Set
  • Map
  • sObject

98. How many events do we have in Aura components? How are they used?

Answer: There are three types of events:

  1. Component Events: Used when data is sent from child to parent.
  2. Application Events: Used when data is sent from one component to another component that is not in any hierarchy
  3. Standard Out of Box Events: Some default events which can be used by us. Example: showcase.

99. What is Visualforce?

Answer: Visualforce is a component-based framework that is using tag-based markup language like HTML. The framework is based on the MVC paradigm where controllers can be generated automatically and integrated with the database.

100. What is a visual force controller? What are they used for?

Answer: Visualforce controllers help us in handling what happens when a user performs a certain function such as clicking a button or link. There are 3 different types of controllers:

  1. Standard Controllers( save, edit, cancel and delete)
  2. Custom Controllers ( can override standard and create new functionality)
  3. Controller extensions (extend standard controllers)

101. What is a wrapper class?

Answer: A wrapper or container class is a class, data structure, or abstract data type whose instances are a collection of other objects. It is a custom object defined by the Salesforce developer where he defines the properties of the wrapper class. Within Apex & Visualforce this can be extremely helpful to achieve many business scenarios within the Salesforce CRM software.

102. What are Static Resources? How is it helpful?

Answer: Static resources help us in uploading documents, files, images, and libraries archived as .zip, and .jar files. These can be later referenced in Visualforce pages or lightning pages. These static resources are references using $Resource variables.

Salesforce FAQs

How do I prepare for a Salesforce Interview?

Preparing well for a salesforce interview will help you answer the questions more confidently, thus creating a good impression on the recruiter. You can prepare for a salesforce interview with the help of this blog which covers the most commonly asked questions.

How do I pass an interview in Salesforce?

Having comprehensive knowledge and skills will help you pass the interview process. Reading through blogs, taking upskilling courses, and practicing your skills will help you in becoming more confident in answering the questions and help you pass the salesforce interview.

Why do you want to join Salesforce?

A fast-paced environment where individuals need to constantly adapt new features, customers, and products. Salesforces have several career opportunities and have a positive impact on career growth as well.

What is meant by Salesforce?

A company that works on making cloud-based tools and software to help businesses and organizations close deals, and find new prospects and customers.

What are the 6 benefits of Salesforce?

Some of the benefits of Salesforce are as follows:
– Dashboards that visually show data
– Trustworthy reporting
– Proactive service
– Simplified collaboration
– Improved messaging with automation
– Efficiency enhanced by automation

What is CRM full form?

The full form of CRM is Customer Relationship Management.

What are CRM tools?

Customer relationship management tools or CRM tools allow us to store customer information, record service issues, identify sales opportunities, and manage marketing campaigns as well. All in one central location.

This brings us to the end of the blog on the top salesforce interview questions. We hope that you are now better equipped to attend your upcoming interview. If you wish to learn more about such concepts, you can enroll in the Free Online Courses offered by Great Learning Academy. If you have any queries, feel free to leave them in the comments below and we’ll get back to you at the earliest.

No comments:

Post a Comment