salesforce interview questions

A typical Salesforce interview goes in three ways.

  1. Scenario based interview
  2. Topic based interview
  3. Work related interview

Let’s start with the first one:

Scenario Based Interview:

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, then you better prepare for all these topics thoroughly. 

Topic Based Interview:

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 interview 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

Work Related Interview:

In this type of interview, the interviewer is searching more on whether you are apt for their model of work. Whether you are the right candidate who can blend in better than others. So the questions will be based on what you have done recently in your work. So there can be questions that might be related to your background before working in Salesforce. Some questions on the working model in your current organisation. They check whether you are aware of what the other team members do. So this interviewer will focus more on your learning mindset, team player attitude, how you can blend in etc.

Let’s dive into the salesforce interview questions which will be asked in these type of interviews:

Scenario Based Interview

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

Answer: Object: Case

Trigger: Before insert


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

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

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

3. 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. 

4. Let say a user does not have permission on a child object and is having permission on parent object to read/create/edit/delete parent object, If there is a trigger on parent object to insert a child record after 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.

5. 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.

6. 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");
        "entityApiName": "ObjectApiName"

7. 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 the 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).

8. I have two objects Object1 and Object2 which are not related to each other. Now I want to create a Master Detail Relationship(MDR) between these objects. How can I do this?

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.

9. The requirement is to delete a set of records and dont want them to be stored 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 apex by calling emptyRecycleBin().

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

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

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

Topic Based Interview Questions

  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

1. 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 create, read, edit, and delete 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 the 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.

2. 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. 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

3. 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.

4. 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 end-end test)
  4. Full (Same size as Production, refreshes in 28 days, Used for UAT testing)

5. 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

6. 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 relationship
  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 detail 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 upto 40 lookup relationships per object.

Many to many relationships:  There is no such relationship such 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 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 which was introduced with Salesforce Connect. We use this relationship to link an external object to another external object. It supports Standard lookup relationships that uses 18 characters Salesforce Id for the association.

7. What is SOQL and SOSL? What are the differences?

Answer: SOQL (Salesforce Object Query Language) are 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 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 multiple objects at one time. It cannot be used in triggers. It returns fields as results. DML operations cannot be performed on these results.

8. 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.

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

Answer:  The different ways to deploy to production are:

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

10. 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

1. What does the lightning component bundle contain?


The lightning component contains the following:

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

2. Name the different lightning component models?


The two lightning component models are 

  1. Aura Component Model
  2. Lightning Web Component Model

3. What is Lightning App Builder?


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

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

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

5. What are the tools used in Lightning?


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

6. What are the advantages of using Lightning?


  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

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

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

8. 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

9. 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

10. What kind of framework does Lightning use?

Answer: Lightning uses Component based framework.

C. Reports and Dashboards

1. 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 report from different report types)

2. What is a bucket field?

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

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

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

4. 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 which is the same for all users. Dashboards can have upto 20 components. Dashboards show data according to the last run report.

5. 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 which is specific to that user and the data which he has access to.

6. 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 it into an excel file.

7. Can we create formula fields in Reports?

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

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

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

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

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

10. What is not supported in Joined reports?


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

D. Trigger, Workflow and Process Builder

1. 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 which 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)

2. 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 which 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

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

Answer: 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

4. What is an approval process? 

Answer: Approval process is used to provide the user 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 of the 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

5. 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.

6. How is process builder and flow builder different?

Answer: Simply put the process builder is designed to be the simpler tool. It is much linear in 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 in updating only child records of the parent record which started the process.

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

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

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

8. 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 and subordinates etc.

9. 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 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 delete triggers
  11. oldMap: This variable returns the list of Ids of the old versions of the sObject records
  12. size: This is variable returns the total number of records invoked by the trigger 

10. 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

1. What is Integration? Explain.

Answer: Integration is connecting two applications. An enterprise uses a lot of applications which 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.

2. What are the different ways to integrate in Salesforce?

Answer: There are 3 different ways to integrate in 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 synchronisation requirements, where one application in an enterprise acts as the primary source for a particular business object, like Account.

3. How many APIs are available in Salesforce?

Answer: They are 11 different APIs. They are:

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

4. What is webservices?

Answer: Webservices is a functionality which 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.

5. 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.

6. 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 which 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.

7. Syntax of a simple test Method?


private class MyTestClass {  
   static testMethod void myTest1() {
   static testMethod void myTest2() {

8. 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)

9. What is seeAllData?

Answer: The test classes cannot recognise 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.

10. 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

1. 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. 

2. Difference between imperative and wired apex methods


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.

3. What is @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.

4. Can we use Aura inside a LWC and vice-versa? 

Answer: No , we cannot use Aura inside a 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.

5. Name some data types used in aura components?


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

6. 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 which are not in any hierarchy
  3. Standard Out of Box Events: Some default events which can be used by us. Example: showToast.

7. 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.

8. What is a visualforce controller. What are they used for?

Answer: Visualforce controllers helps 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)

9. What is a wrapper class?

Answer: A wrapper or container class is a class, data structure, or an abstract data type whose instances are a collection of other objects.It is a custom object defined by 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.

10. What is Static Resources ? How is it helpful?

Answer: Static resources help us in uploading documents, files, images, 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.

This type of interview will be purely based on how your organisation uses Salesforce. Some of the common questions asked are:

1. What license does your organisation use?
2. What platform have you worked on?
3. How is the working model in your organisation?
4. What is the process of development and deployment?
5. How do you backup the data in your organisation?
6.What profile do you use to test? What all permissions are provided?
7. Which feature have you worked on most ? Questions based on that
8. What are your day to day duties?
9. Are you involved in solving production tickets? If yes how is the process of resolution
10. What is the toughest work in salesforce you have undertaken until now?

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 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. 



Please enter your comment!
Please enter your name here

sixteen − twelve =