Salesforce interview questions for developers
100+ Salesforce interview questions for developers with answers in pdf download.

Salesforce interview questions for developers
Basic Salesforce Interview Questions for Freshers (1–25)
1. What is Salesforce?
This is one of the most basic salesforce interview questions, where the interviewer is simply checking if you can club your knowledge into a quick answer or not!
Here’s a short and straightforward answer to this salesforce interview question – Salesforce is the most effective Customer Relationship Management (CRM) product that is delivered to subscribers as a cost-effective software-as-a-service (SaaS).
2. What does Salesforce do?
Salesforce provides CRM software and cloud-based solutions that help enterprises to connect better with their customers. It supports businesses to manage their customer’s data and track their activities efficiently.
3. What are the features of Salesforce
Contact management
- It provides easier contact management by giving access to critical data of the customers and interaction history.
- It gives complete customer details including insights and engage-enhancement strategies. Social data of the customers can be used for a deeper understanding of their particular behavior regarding any product or service.
Opportunity management
- Salesforce provides an opportunity to view the activity timeline of your customers. It represents different stages of a particular deal which helps you to decide your next move.
- You can see critical details of the activity timeline in addition to the business competitors. The readymade templates ensure hassle-free emailing to the clients.
Quote management
- Quote management of the products will have tracking of the products, which are part of your deal and it includes the standard price, product code, quantity, and quoted price. Also, you can establish quantity along with revenue schedule and it reflects the delivery terms and payment.
- The Salesforce CRM app has a built-in quoting mechanism that automatically quotes client data. It also creates an approved template PDF and sends it directly to the customer as an email.
Lead management
- Lead management is featured with an affluent activity timeline. It provides access to up-to-date contacts on the timeline. Also, it makes use of the sales paths to understand the related documents.
- CRM app functions as a fast lead converter machine, which informs you about the original source of the leads. Automatic emailing boosts your revenue-generating mechanism.
Sales data
- Using Salesforce CRM you can get the right sales data at the right time. It provides a faster connection with key decision-makers.
- You can easily plan territories. It can be used for increasing sales and marketing productivity with the latest and most accurate data.
Mobility
- The Salesforce mobile app turns your mobile device into a portable sales office by allowing the users to access CRM data at any time and from anywhere.
- You can log calls, work opportunities, check dashboards, respond to hot leads, etc.
Workflow and approvals
- It allows the use of visual workflow to rapidly design and automate any of the business processes with drag and drop simplicity. And you can successfully manage flexible approvals processes for deal discounts, expenses, and more.
File sync and share
- It’s easier to share files, discuss them, publish the best and track your content in real-time by using Salesforce.
- You can quickly find what you are looking for, share it securely, and also subscribe to receive alerts when something changes.
Dynamic dashboards and custom reports
- Dashboards offer a real-time picture of how your business is performing in the market. Users can recognize market trends, calculate the activities and clear up the quantities. You can build your own dashboard by using drag and drop icons in Salesforce CRM.
- It allows creating your own customized sales forecasting report with Salesforce CRM. By using a simple drag and drop feature, users are able to adjust the fields and view data with filters. Charts provide real-time data to give you the latest insight.
Sales forecasting
- It tracks the journey of the leads in the pipeline to look into whether they are reaching their destination i.e. deals or not. It gives brilliant forecasting on sales upon analyzing the same. You can apply your right judgment to the forecasted amount and according to that, you can plan your strategies.
- You can make use of in-line editing, multi currency support, override visibility, etc. to stay on top of your business.
- It gives the right credit to the right person and permits them to see the forecast as per overlays.
4. What is an object in Salesforce?
In Salesforce, objects are database tables that are used to store the data of an organization. There are two types of objects in Salesforce. They are:
- Standard object: These are the objects provided by the Salesforce platform, which includes contacts, accounts, cases, campaigns, opportunities, leads, products, contracts, reports, dashboards, etc.
- Custom object: They are objects created by developers based on the business process. It stores the important and unique information of an organization. It gives a structure for data sharing. The custom object includes page layouts, custom fields, relationship to other objects, custom user interface tab, etc.
5. What is meant by an App in Salesforce?
An App in Salesforce is a logical container that holds various details related to the company such as a logo, name, business operations, etc. You can customize apps to match your needs, or you can develop new applications by combining custom and standard tabs.
The process to create an app in Salesforce is given below:
Setup —> build—> Create—> App—> Click on new.
By following the above procedure, you can develop an application as you want.
6.What does a custom object permit the user to do?
Once the custom object is defined, the subscriber can perform the following tasks:
- Create custom fields
- Relate the custom object to other records
- Track events and tasks
- Build page layouts
- Create a custom tab for the custom object
- Analyze custom object data
- Create dashboards and reports
- Share custom tabs, custom apps, custom objects, and various other related components.
7. What are the Salesforce subsidiaries?
The following are the major subsidiaries of Salesforce:
- Tableau
- Pardot
- Heroku
- Mulesoft
- Demandware Inc
- SalesforceIQ
None of these tasks can be accomplished until the custom object has a definition.
8. What type of apps can we create in SF?
We can create two types of Apps in Salesforce
Custom app: This type of app can be used in every business scenario. It is widely used in the market.
Console app: This type of app can be used only in the client service business, where we focus on solving the client’s issues. It is not, comparatively, widely used in the market.
9. What is Self-Relationship?
A Self-Relationship is a lookup relationship to the same object. It is this premise that allows users to take the object “Merchandise” and create relationships with other objects.
10. What is Object Relationship Overview?
In Salesforce, the object relationship overview links custom object records to standard object records in a related list. This is helpful to track product defects in related customer cases.
Salesforce allows users to define different types of relationships by creating custom relationship fields on an object.
Want to download these Salesforce Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
11. What can cause data loss in Salesforce?
Data loss in Salesforce can be caused by a number of reasons, including:
- Changing data and date-time.
- Migrating to percent, number, and currency from other data types.
- Changing from the multi-select picklist, checkbox, auto number to other types.
- Altering to multi-select picklist from any type except picklist.
- Changing to auto-number except for text.
- Changing from text-area to email, phone, URL, and text.
12. How is SaaS beneficial to Salesforce?
SaaS is subscription-based, so clients can choose not to renew and discontinue using the program at any time without penalty other than not being able to use Salesforce.
SaaS is intended to help users avoid heavy initial startup fees and investments. SaaS applications use a simple Internet interface supported by easy integration.
13. How does Salesforce track sales?
Salesforce is a tracking program that records a number of helpful basic details, such as:
- Number of customers served daily
- Daily sales volume
- Detailed reports from Sales Manager
- Sales figures by month or quarter
- Most importantly, Salesforce tracks and reports repeat customer activity, which is the key to any sales organization.
14. How many types of relationships are offered by Salesforce.com?
Salesforce recognizes two relationship types: Master-detail relationships and Lookup relationships.
15. What is the trigger?
The trigger is the code that is executed before or after the record is updated or inserted.
16. What is the difference between Trigger and Workflow?
This is one of the most frequently asked Salesforce interview questions. Workflow is an automated process that fires an action based on evaluation criteria and rule criteria.
As described above, the Trigger is the code that is executed on or after the record is updated or inserted.
17. What is a static resource in Salesforce?
With Salesforce’s static resource, subscribers can upload zip files, images, jar files, JavaScript, and CSS files that can be referred to in a Visualforce page. The optimum size of static resources in Salesforce is 250 MB.
18. If I don't provide any arguments on the command line, then what will the value stored in the String array passed into the main() method, empty or NULL?
Force.com is Platform-as-a-Service (PaaS), while Salesforce.com is Software-as-a-Service (SaaS).
19. Is there a limit for data.com records?
Salesforce users can see their limit form setup easily by simply clicking data.com administration/Users. From the data.com users section, the users can see their monthly limit and exactly how many records are exported during the month.
20. What are the three types of object relations in Salesforce?
In Java, access specifiers are the keywords which are used to define the access scope of the method, class, or a variable. In Java, there are four access specifiers given below.
- Public The classes, methods, or variables which are defined as public, can be accessed by any class or method.
- Protected Protected can be accessed by the class of the same package, or by the sub-class of this class, or within the same class.
- Default Default are accessible within the package only. By default, all the classes, methods, and variables are of default scope.
- Private The private class, methods, or variables defined as private can be accessed within the class only.
Want to download these Salesforce Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
21. What are the different types of reports available in Salesforce?
The different types of reports in Salesforce are:
- Tabular report that displays the grand total in table form
- Matrix report where grouping is based upon both rows and columns
- Summary reports are detailed reports in which the grouping is based on columns.
- Joined report which allows two or more reports to be joined in a single report
22. Is it possible to schedule a dynamic dashboard in Salesforce?
In Salesforce, it is not possible to schedule a dynamic dashboard.
23. What is the junction object and what purpose does it serve?
Junction objects are used to build many-to-many relationships between objects. For example, the user can take a recruiting application where a position for a job can be linked to many candidates or can link a candidate to many other jobs.
To connect the data model, a third-party object is referred to as a junction object. In the given example, the junction object is “job application.”
24. What is an Audit Trail?
The Audit Trail function in Salesforce is useful for gaining information or for tracking all the recent setup changes that the administration has done in the organization. The audit trail can preserve data for up to six months.
25. Explain the Salesforce dashboard?
In Salesforce, the dashboard is a pictorial representation of the report. 20 reports can be added to a single dashboard.
Intermediate Salesforce Interview Questions (26–60)
26. What are the benefits of using Salesforce CRM?
We get the following benefits by using Salesforce CRM.
- Improved organizational understanding.
- Enhanced communication.
- We can understand the customer better and can facilitate better services.
- Salesforce automates repeated rule-based tasks.
- Improved analytics and dashboards to analyze the data.
- Reduction in cost and cycle time.
- Improves the efficiency of teams.
27. What is a profile? Can two users have the same profile?
The profile is defined as a collection of rules and procedures a person needs to follow to access particular records. There are multiple profiles available in Salesforce. For example, a sales profile can have access to leads, opportunities, contacts, campaigns, etc.
As far as the second question is considered, the answer would be yes. The people who work in one department have the same profile. So the people who work under a particular department would be assigned with the same profiles.
As we have seen in the sales profile, many people work under it and every person who works under is assigned the same profile. Hence any number of people can have the same profile.
28. Explain the difference between role and profile?
Role: In Salesforce Role is meant to increase the data visibility to a particular user. It can be done through sharing rules or by building a role hierarchy. Using roles, you can control the ac
Profile: Unlike the roles profile is mandatory for all, and it stays at the object level. It is treated as a building pillar of an organization.
29. How many relationships do we have in Salesforce?
We have three types of relationships in Salesforce, which are:
- Master-detail relationship
- Lookup relationship
- External Lookup
30. What is the Master-Detail relationship?
This Master-Detail relationship is the same as the relationship between a parent & child. In this aspect, the master is treated as Parent, and the Detail is a child. The master Object takes control of the behavior of the Detail object.
The survival of the child is dependent on the parent because if the Master gets deleted the Detail will also automatically get deleted. You can create Roll-up summary fields in master records which helps in calculating the Min, Avg, and Sum of the child records.
Want to download these Salesforce Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
31. What is a “Lookup Relationship”?
The relationship between the two objects is called a lookup relationship. Lookup relationships connect two object links together so that you can look up from related items to other items. It can be one-to-one or one to many.
32. What is an External lookup?
The external lookup relationship is used to connect the child object to the parent object. The child object may be either a custom, standard, or external object.
It is used to identify the correct map of the child object with the parent external object. The external lookup relationship values fields are matched against the External Id values.
33. What is the sharing rule?
Sharing rules are applied when a user wishes to permit access to other users like public groups, roles, or territories. It gives greater access to particular users by making automatic exceptions to your organization-wide sharing settings.
You can define total sharing rules up to 300 for a particular object, including criteria-based or guest user sharing rules up to 50, if available for the object.
34. What is the difference between SOQL and SOSL?
SOQL (Salesforce Object Query Language) retrieves records from one object at a time, plus related parent or child objects through relationships. You use it when you know which object holds the data, for example SELECT Id, Name FROM Account WHERE Industry = 'Banking'.
SOSL (Salesforce Object Search Language) is a text search across several objects at once. You use it when you don’t know which object or field holds the value, for example FIND 'Acme*' IN ALL FIELDS RETURNING Account(Name), Contact(Name).
- SOQL returns a list of sObjects; SOSL returns a list of lists, one per object.
- SOQL can be used in triggers and supports aggregate functions; SOSL cannot be used in triggers.
- Governor limits: 100 SOQL queries and 20 SOSL queries per synchronous transaction.
35. What are Apex trigger context variables?
Context variables are static variables of the Trigger class that tell the trigger which records fired it and why. The most used ones are:
Trigger.new– list of new versions of the records (insert, update, undelete).Trigger.old– list of old versions of the records (update, delete).Trigger.newMapandTrigger.oldMap– the same records as a Map of Id to sObject.Trigger.isBefore,Trigger.isAfter– the timing of the event.Trigger.isInsert,Trigger.isUpdate,Trigger.isDelete,Trigger.isUndelete– the DML operation.Trigger.operationType– a single enum such as BEFORE_INSERT, useful in a switch statement.Trigger.size– the total number of records in the trigger call.
36. What is the difference between "with sharing" and "without sharing" in Apex?
Apex runs in system mode by default, so these keywords decide whether the running user’s record-level sharing rules are applied.
with sharing– the class enforces the current user’s sharing rules, so queries return only records the user can see.without sharing– sharing rules are ignored and the class can see all records. Use it only when the logic genuinely needs it.inherited sharing– the class takes the sharing mode of the class that called it; if it is the entry point, it runs as with sharing.
These keywords control record access only. Object and field permissions must be enforced separately, for example with WITH USER_MODE in SOQL or Security.stripInaccessible().
37. What is Apex in Salesforce?
- Apex is a strongly typed and object-oriented programming language that permits developers to execute flow and transaction control statements on Salesforce platform servers in conjunction with calls to the API. It uses syntax that looks similar to Java and pretends like database stored procedures.
- Apex allows developers to add business logic to many system events, including Visualforce pages, button clicks, and related record updates. This code can be initiated by requests from web services and from triggers on objects.
- All Apex code runs completely on-demand on the Lightning platform. Apex code is written and saved to the platform by developers. Through the user interface, end-users trigger the execution of Apex code.
38. What are Governor limits in Salesforce?
- Governor limits control how much data a shared database can store. They help to make sure that no one monopolizes the shared resources like storage, CPU, and memory. Whenever the Apex code exceeds the limit, it issues a runtime exception that cannot be handled.
- The following list gives some of the governor limits in Salesforce:
- Push notification limits
- Per-Transaction Apex limits
- Size-Specific Apex limits
- Miscellaneous Apex limits
- Static Apex limits
- Email limits
- Examples of governor limits in Salesforce:
- The total number of sendEmail methods permitted is 10.
- The total number of records retrieved by a SOQL query is 50,000.
- Maximum CPU time on the Salesforce servers is 10,000ms on synchronous Apex.
- The total number of callouts(web services calls or HTTP requests) in a transaction is 100.
39. What are Salesforce Flows and when should you use Apex instead?
Flow is Salesforce’s declarative automation tool. With Flow Builder an admin can build record-triggered flows, screen flows, scheduled flows and autolaunched flows without code. Salesforce now recommends Flow in place of Workflow Rules and Process Builder, which are being retired.
Choose Apex instead of Flow when:
- The logic is complex, with many nested loops, maps or heavy data processing.
- You need to process large data volumes that would hit Flow limits.
- You need callouts with complex error handling, custom REST/SOAP services or advanced integrations.
- You need fine control over transactions, recursion and unit testing.
A common approach is “Flow first, Apex when needed”: many teams also call invocable Apex methods from a Flow to combine both.
40. What are the different ways to share a record?
- Role hierarchy: When a user is added to a role, all users above the current user in the role hierarchy have access to reading and sharing the records and inheriting permissions. The steps for role hierarchy are:
Setup → Manage Users → roles → set up roles and click on ‘add role’, → create a name and click on save.
- OWD: Organization-Wide Defaults allow you to define an organization’s baseline setting and give permissions to the organization-wide. It helps define a user’s accessibility level where they can view other users’ records. For OWD, follow these steps:
Setup → Security Controls → click on ‘sharing settings’ → Edit.
- Manual sharing: For sharing a single record/file to a particular user/group of users via manual access. A button is available on the detail page of the record when the OWD setting is private.
- Criteria based sharing rules: We have to share records based on conditions. For instance, share records with a user/group with the criteria of the country- India. The steps for sharing are:
Setup → security controls → sharing settings → select the object, provide name and conditions, and then click on save.
- Apex sharing: One can share every object in Salesforce by creating a record for the shared object.
Want to download these Salesforce Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
41. What do you understand about the Future annotation(@future)?
Future annotations specify methods that are executed asynchronously. These methods with future annotation should be static and can only return a void type.
The arguments mentioned should be primitive data types/collections of primitive data types/ arrays of primitive data types.
A method specified with @future annotation will be executed once Salesforce has available resources.
42. Explain the types of SOQL statements in Salesforce.
The Salesforce Object Query Language or SOQL is employed in querying the records from database.com as and when required. The two types of SOQL statements are as follows:
- Static SOQL: It is written using [] (array brackets) and is similar to LINQ (Ion Integrated Query). It is suitable when there are no dynamic changes in the SOQL query.
- Dynamic SOQL: It is suitable for referring to the SOQL string creation at run time with Apex code. It allows the creation of more flexible applications. For instance, you can create a search based on updated records or end-user input with varying field names
43. What are the various types of email templates available in Salesforce?
- Text: All the users in an organization have access to creating or changing these templates.
- HTML with letterhead: Users with the “Edit HTML Templates” permission and administrators can create these templates based on a letterhead.
- Custom HTML: These are an extension of HTML with a letterhead. Administrators and users with “Edit HTML Templates” permissions can create them without using the letterhead.
- Visualforce: Administrators and developers can create them using Visualforce. They have advanced functionalities such as merging with a recipient’s data.
44. What is Salesforce Lightning?
Salesforce Lightning is a component-based application development framework with a collection of tools and technologies for effectively increasing the Salesforce platform’s performance.
The tools include visual upgrades, optimized interfaces, and more. It simplifies processes for business users who have no programming experience.
It allows the easy and quick creation of applications that solve business issues and enhance engagement. Some key features are:
- Provides a drag-drop facility for app creation and customization.
- Has tools and extensions for the development of reusable components.
- AppExchange for over 50 partner components.
- Has style guides and provides user experience practices for app development.
- Lightning Connect is an integration tool for applications of Force.com to consume data from an external source that meets the OData specification.
45. State two examples of Salesforce API and their usage.
Salesforce has several APIs for developers to interact with the system. Examples of Salesforce API are:
- Streaming: The Streaming API is useful for triggering and receiving notifications when a change is made to Salesforce data according to the defined SOQL query criteria. It can be used to push notifications from the server to the client based on defined criteria.
- Bulk: It provides programmatic access for quick loading and querying a huge amount of data into your Salesforce organization.
46. What are the permission sets?
A Permission set is a collection of settings or permissions and is used to extend the user’s functional access without changing actual profiles.
You can use permission sets for various types of users to extend the functionality access regardless of their roles. It is a time taking task to create a profile; instead of this, you could easily create a permission set.
47. What is the difference between Queueable Apex and Batch Apex?
Both are asynchronous Apex, but they are built for different jobs.
- Queueable Apex implements the
Queueableinterface and is started withSystem.enqueueJob(). It accepts complex types such as sObjects as member variables, returns a job Id you can monitor, and allows chaining one job from another. It suits moderate workloads and callouts. - Batch Apex implements
Database.Batchablewith start, execute and finish methods. It splits up to 50 million records into chunks (default 200 records per execute), and each chunk gets fresh governor limits. It suits large data clean-up, recalculations and nightly jobs.
Rule of thumb: use Queueable for a single background task, and Batch Apex when you must process very large record sets.
48. What are the default indexed fields in Salesforce?
We have some fields which are indexed by default in Salesforce, which are :
- Name
- ID
- Owner fields
- Master-detail relationship fields
- Lookup fields
- Last modified dates
- Audit dates
49. What is the Fiscal year in Salesforce?
The Fiscal year is known as the starting and ending date of a company’s financial year. We have two types of financial years in Salesforce which are as follows.
- Standard fiscal year
- Custom fiscal year
50. List some examples of custom fields?
There are many custom fields available such as Picklist, Currency, Date, Text, Picklist (multi-select), Email, Percent, Number, Phone, Text area, Lookup relationship, Geolocation, Checkbox, Master-Detail relationship, etc..
Want to download these Salesforce Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version

51. What are the different ways to store various types of records in Salesforce?
We have five different ways in Salesforce to store various types of records such as images, files, and documents.
They are
- Attachments
- Google drive
- Chatter Files
- Libraries
- Attachments.
52. What is the main difference between data table vs page block table tags?
The differences between the Data table and Page block
Page block:
- It defines inside the page block station or page block
- To design the visual pages uses style sheets
- The required attribute is “value”
- Automatically it will display Column Headers
DataTable:
- No need to mention inside the page block station or page block
- No required value.
- The data will be displayed using custom style sheets.
- we need to specify column headers explicitly.
53. What is a test class in Apex and why is @isTest used?
A test class contains unit tests that check your Apex code works as expected. The @isTest annotation marks a class or method as test code, so it does not count against your org’s code size limit and never runs in production.
- At least 75% of Apex code must be covered by tests, and every trigger must have some coverage, before you can deploy to production.
- Test data is created inside the test (often in a
@testSetupmethod); tests cannot see org data unlessSeeAllData=trueis used, which is not recommended. Test.startTest()andTest.stopTest()give a fresh set of governor limits and force asynchronous code to finish.- Use
System.assertEquals()or theAssertclass to check results; coverage without assertions does not prove the code works.
54. What is Schedulable Apex?
Schedulable Apex lets you run an Apex class at a specific time, such as every night or every Monday. The class implements the Schedulable interface and its execute(SchedulableContext sc) method.
You can schedule it from Setup > Apex Classes > Schedule Apex, or in code with a cron expression, for example System.schedule('Nightly Job', '0 0 2 * * ?', new MyScheduler()); which runs daily at 2 AM.
A common pattern is a scheduled class that starts a Batch Apex job. An org can have up to 100 scheduled Apex jobs at a time.
55. What is a Lightning Web Component (LWC)?
Lightning Web Components is Salesforce’s modern UI framework for building components with standard web technologies: HTML, JavaScript (ES6+) and CSS. Because it uses native browser features such as Web Components and Shadow DOM, it is lighter and faster than the older Aura framework.
Each component is a folder with an HTML template, a JavaScript class and an XML configuration file that controls where it can be used (Lightning App Builder, record pages, Experience Cloud, utility bar and so on). LWCs read and write Salesforce data with Lightning Data Service, @wire adapters or imperative Apex calls.
56. Is it possible to restrict access to data using sharing rules?
The sharing rules are used only for allowing greater access to records not for restricting.
57. What are the lifecycle hooks in Lightning Web Components?
Lifecycle hooks are callback methods that run at specific stages of a component’s life:
constructor()– runs when the component is created. Callsuper()first; do not access child elements or attributes here.connectedCallback()– runs when the component is inserted into the DOM. Good for loading data or subscribing to events.renderedCallback()– runs after every render. Use it carefully to avoid infinite render loops.disconnectedCallback()– runs when the component is removed. Use it to clean up listeners and subscriptions.errorCallback(error, stack)– runs when a child component throws an error, letting the parent act as an error boundary.
58. What is the difference between Aura components and Lightning Web Components?
- Technology: Aura is Salesforce’s proprietary framework; LWC is built on web standards that browsers support natively.
- Performance: LWC is faster because less framework code runs in the browser.
- Syntax: Aura uses component markup, a controller and a helper; LWC uses a standard JavaScript class and an HTML template.
- Learning: LWC skills transfer to general web development; Aura skills are specific to Salesforce.
- Interoperability: an Aura component can contain an LWC, but an LWC cannot contain an Aura component.
Salesforce recommends LWC for all new development, while existing Aura components continue to work.
59. What is Lightning Data Service (LDS)?
Lightning Data Service is the standard data layer for Lightning Web Components and Aura components. It lets a component create, read, update and delete Salesforce records without writing Apex.
- It caches records on the client and shares them between components, so if one component updates a record, every other component showing it refreshes automatically.
- It respects the user’s object permissions, field-level security and sharing rules.
- In LWC you use it through base components such as
lightning-record-form,lightning-record-edit-formandlightning-record-view-form, or through wire adapters and functions fromlightning/uiRecordApisuch asgetRecord,createRecordandupdateRecord.
Use LDS for single-record operations, and Apex when you need complex queries or work with many records at once.
60. What is the @wire decorator in LWC?
The @wire decorator connects a property or function in an LWC to a data source. Salesforce calls it reactively: data loads automatically and refreshes when a reactive parameter (prefixed with $) changes.
You can wire to Lightning Data Service adapters such as getRecord or to an Apex method marked @AuraEnabled(cacheable=true). Example: @wire(getContacts, { accountId: '$recordId' }) contacts; The wired value has data and error properties.
Use an imperative Apex call instead when you need to control when the call happens, or when the method changes data (DML).
Want to download these Salesforce Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
Advanced Salesforce Developer Interview Questions (61–100)
61. Explain the Force.com platform
Force.com is the entire framework and codebase on which the whole Salesforce application exists.
We can also say that Salesforce is built on Force.com, which is a Platform as a Service (PaaS) that allows us to simplify the design, development, and deployment of cloud-based applications and websites.
Developers can work with Cloud Integrated Development Environment (Cloud IDE) and deploy the applications on the servers of Force.com.
62. Explain different components of the dashboard available in Salesforce.
Some of Salesforce dashboard components are explained below:
- Gauge: It is used for displaying a single value within a custom value range.
- Metric: This is used for showing a single pair of key–values. We can enter the metric label directly on the components by clicking the empty text field next to the grand total. All metrics placed in the dashboard column would be displayed as a single component.
- Table: Tables are used for showing report data in the form of lists. For example, top five or bottom five opportunities.
- Visualforce page: It is used for forming a custom component as a dashboard or displaying information that is not available in other component types.
- Charts: It is used for showing comparisons. Charts are divided into 6 types. They are line Chart, vertical bar chart, horizontal bar chart, donut, pie, and funnel.
63. What are validation rules in Salesforce?
- Validation rules in Salesforce consist of a formula or expressions that evaluate the data in one or more fields in a record to meet the standards you specify before the user can save the record. It returns a “True” or “False” value based on the evaluation of the data. Validation rules are responsible for displaying an error message to the user when the condition is “True” due to an invalid value.
- Validation rules are helpful in enforcing integrity constraints against the data. Here we give conditions in the formula editor. If one validation rule fails, Salesforce proceeds to check another validation rule held within the field or record and shows an appropriate error message at that particular field or above the record.
- You are allowed to create validation rules for fields, objects, campaign members, or case milestones. For example, we can create a validation rule that fires when a user tries to save an account with the incorrect length for the account number.
64. How do you handle exceptions in Apex?
Apex uses try, catch and finally blocks, like Java. Code that may fail goes in try, catch handles a specific exception type, and finally runs whether or not an error occurred.
- Catch specific types such as
DmlException,QueryException,NullPointerExceptionorCalloutExceptionbefore the genericException. - Create custom exceptions by extending
Exception, for examplepublic class InvalidOrderException extends Exception {}. - Use
addError()in triggers to show a friendly message and block the record from saving. - Log errors (for example to a custom log object or Platform Event) instead of silently swallowing them.
- Governor limit exceptions such as
LimitExceptioncannot be caught, so code must be written to stay within limits.
65. What is Visualforce in Force.com?ṣ
- Visualforce can be defined as the UI for the Force.com platform that allows developers to build sophisticated, custom user interfaces which can be hosted natively on the Lightning platform.
- This Visualforce framework includes a tag-based markup language, a set of server-side “standard controllers” that forms basic database operations(such as queries and saves) and each Visualforce tag corresponds to a user interface component such as a field, section of a page, or a related list, etc.
- It works on the standard MVC model. It can have strong integration with the database and deploy auto-generated controllers for database objects. The behavior of Visualforce components can be controlled by the developer, by utilizing the same logic that was used in standard Salesforce pages. It is also possible for a developer to associate their own logic with a controller class written in Apex code.
66. What are record types in Salesforce?
- Salesforce record types permit us to associate different business processes and display different picklist values and page layouts to different users based on the user profile.
- Administrators have the ability to associate record types with the user profiles so that, in the record’s detail page, different users will be able to see different picklist values and page layouts.
- For example, consider a case where record types are most often used i.e., to create two different sales processes on the Opportunity object. Each of them with different sales stages and page layouts. This will indicate that with record types you will be able to apply multiple page layouts per object as well as per user profile.
- Benefits of record types:
- It modifies user interaction experience to specific needs of the business.
- Allows for administration in a simple manner as there are fewer fields to maintain.
67. What are page layouts related to Salesforce?
- Page layouts are used to control the layout and organization of buttons, fields, Visualforce, custom links, s-controls, and related lists on object record pages.
- They are helpful in organizing user interface pages by determining which fields, related lists, and custom links are required, read-only, and visible for the user.
- We can create many page layouts and apply them to different user groups, with the aim of creating a customized experience. For example, you could have a single account record like ACME Corp., but it displays different information depending on your user profile.
- Here, you can only apply the one-page layout to a single group of users per object, per record type. For example, if you have one record type based on the Accounts object, you can apply only one-page layout per profile.
68. What are the two types of triggers in Salesforce?
Below are the two types of Apex triggers in Salesforce:
Before triggers: It can be used to update or validate record values before it is saved to the database.
trigger TriggerName on ObjectName(before event) //Here event can be insert, update or delete
{
code_block
}
After triggers: It can be used to access field values of the records that are set by the system (such as record’s ID or LastModifiedDate field) that are stored in the database and use this field value to do the changes in other records. Records that fire after the triggers are read-only.
trigger TriggerName on ObjectName(after event) //Here event can be insert, update or delete
{
code_block
}
69. What is the Roll-up summary field?
We use the Roll-up summary field to calculate the values for the associated records, for example, a related list. We can also use it for creating the values for a master record- according to the values in detailed records.
But, we must connect the master and the detail with a master-detail relationship.
70. Explain Queues?
In Salesforce, Queues help us to distribute, prioritize, and assign the records to the teams for sharing workloads. Queues are applicable to leads, service contracts, custom objects, cases, etc.
Want to download these Salesforce Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
71. Explain Time-dependent workflow?
We perform time-dependent actions at particular times before closing the record. Workflow re-evaluates the record after time passes. It checks whether the workflow rule criteria are satisfied, and only then workflow rules execute the actions.
72. What is the Workflow Task and Workflow Alert?
Workflow Task
When we have to assign the tasks to a salesforce user, you haunt a workflow task. Workflow task allocates a new task to a role, user, or record owner. It assists us in defining different task parameters like a priority, status, due date, and subject.
Workflow Alert
Workflow Alert is an email that an approval process or a workflow rule creates in the salesforce and is transmitted to different recipients.
73. Explain Auto-Response?
Auto-Response is about transmitting emails to leads or cases for particular record attributes and promptly responding to customer inquiries or issues by establishing the auto-response rule. At the same time, we can set one rule for a lead and one rule for a case.
74. Explain Custom Labels?
In Salesforce, we use custom labels for creating a multilingual application. Using the native language, they give information to users in the form of help texts and error messages.
We can define the custom labels as custom text values that we can access from the Apex class or Lightning components and promptly or even the Visualforce page.
We can translate these values into the language supported by the salesforce. Through the following path, we can access custom labels:
Setup->Search Custom Labels in Quick Find Box->Custom Labels
75. What are Sharing rules and what are the different types of sharing rules?
Sharing rules give sharing access to the users associated with the public groups, roles or territories. It gives a higher level of access with the exceptions, far from our organization settings. Following are the two kinds of sharing rules:
- Criteria-based Sharing rules: Access is provided according to the record values and not according to the record owners.
- Owner-based Sharing Rule: These rules provide access to the records owned by the users.
76. What is the trigger handler pattern and why is it used?
The trigger handler pattern keeps the trigger itself almost empty and moves the logic into a separate Apex class. The trigger only passes control to the handler, which has methods such as beforeInsert(), afterUpdate() and so on.
Benefits:
- One trigger per object, so the order of execution is predictable.
- Logic is reusable and much easier to unit test.
- Recursion control and bypass switches (for data loads) can be added in one place.
- Code is cleaner and easier for teams to maintain.
77. Define the Approval process?
In Salesforce, the Approval process is a sequence of steps for approving records. An approval process is also helpful for tracking who and when approved or rejected something. It includes different approval models, notifying approvers, and conditional logic for who must support.
78. What is the importance of Salesforce Chatter?
Salesforce Chatter is a social networking application that enables us to share information and work cooperatively with each other. It helps us to build greater employee engagement through motivation.
Salesforce Chatter also provides a forum throughout the enterprise for sharing fresh ideas and understandings. We can also use the mobile feed for tracking our project.
79.What is Apex test coverage?
To assure that our code satisfies particular standards, Apex test coverage displays to you how many lines of code in our classes or triggers have been tested by the tested methods.
Test coverage percentage is the result of the number of covered lines divided by the sum of uncovered lines and covered lines. To deploy to production, we need a minimum of 75% test coverage.
80.Explain Lightning Message Service(LMS)?
Lightning message service is a distinctive salesforce feature that allows interaction between Aura, Lightning Web Components, and Visualforce over the same lightning page. We can use the Lightning message service in Lightning Experience only.
Want to download these Salesforce Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
81. Define OAuth?
OAuth is a standard for access delegation. Generally, we use it as a method for granting the applications or websites access to their data over other websites, yet without providing them with the passwords.
82. Explain Connected App?
Connected App integrates the salesforce through APIs, and Connected Apps utilize OAuth, SAML for authenticating, providing sign-on, and providing tokens for using the Salesforce APIs.
Besides OAuth capabilities, connected apps eagle salesforce admins to establish different security policies and possess external control to utilize similar apps.
83. What is Pagination, and How can we achieve it?
For example, if we have to display 100 records over the page.
- First: Display the first ten records.
- Previous: Display previous ten records.
- Next: Display the following ten records.
- Last: Display the previous ten records.
We can perform the above process through Pagination. We can achieve pagination through the following ways:
Through StandardSetController
Through Offset and Limit keywords in SOQL Query
84. How do we display error messages on the VisualForce Page?
To display error messages on the VisualForce Page, we must use:
<apex:pageMessages></apex:pageMessages>
In Apex class, we must use:
ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.Error, ‘Error Message’));
85. Explain a skinny table. What are the considerations for a skinny table?
Skinny tables in Salesforce are useful in accessing the fields which are frequently used and avoiding joins. This can improve the performance of certain read-only operations such as reports, list views, etc.
Skinny tables are highly effective because skinny tables will be in sync with source tables even when the source tables are modified.
You need to contact Salesforce customer support if you want to use skinny tables. You cannot create, access, or modify skinny tables yourself. For example, you need to contact Salesforce to update your skinny table definition if you want to add new fields.
Considerations for skinny tables are:
- It can contain an utmost of 100 columns.
- It cannot hold fields from other objects.
- For full sandboxes, these skinny tables are copied to your full sandbox organizations. For other types of sandboxes, skinny tables are not copied into your sandbox organizations. To have production skinny tables to be activated, contact Salesforce customer support.
The below figure displays an Account view, a corresponding database table along with a skinny table that can speed up account queries.
86.What do you mean by a sandbox in Salesforce?
A sandbox is a copy of the production environment/ organization and it is used for testing and development.
It’s very useful because sandboxes are completely isolated from your Salesforce production organization, so it allows you to test out new ideas on the duplicate database without disturbing the original production environment.
You can use the sandbox whenever you want to test a newly formed Force.com application or Visualforce page. Instead of testing it directly in production, you can develop and test it in the sandbox organization.
Using this, you can develop the application without any difficulty and then migrate the metadata and data to the production environment.
Doing this in a non-production environment permits developers to freely test and experiment with the newly created applications.
There are four types of sandboxes in Salesforce:
Developer sandbox:
- It is a copy of the production organization, it copies all the information of an application and configuration to the sandbox. It is mainly used for the development and testing tasks in an isolated environment.
- This type of sandbox has limitations of up to 200MB of test or sample data. You can refresh a developer’s sandbox once a day.
Developer pro sandbox:
- It copies all of your organization’s reports, dashboards, apps, price books, products, and customizations under setup. But it excludes all of your organization’s custom and standard object records, attachments, and documents.
- This type of sandbox has limitations of up to 1GB of test or sample data. We can refresh developer pro sandboxes once a day.
Partial data sandbox:
- A partial data sandbox is a developer sandbox plus the data you define in a sandbox template, which is intended to be used only as a testing environment. It includes the reports, dashboards, price books, applications, products, and customizations under the setup (including all of your metadata).
- Additionally, these sandboxes can have your organization’s custom and standard object records, documents, and attachments up to 5 GB of data along with a maximum of 10,000 records per chosen object.
- A partial data sandbox is smaller compared to a full sandbox and has a shorter refresh interval. You can refresh partial data sandboxes every 5 days.
- Sandbox templates permit you to select specific data and objects to copy to your sandbox, thus you can control the size as well as the content of each sandbox. Sandbox templates are available only for partial data or full sandboxes.
Full sandbox:
- It is a replica of production including custom and standard object records, attachments, and documents and is used only as a testing environment.
- You can refresh full-copy sandboxes every 29 days.
87. What are Platform Events in Salesforce?
Platform Events are part of Salesforce’s event-driven architecture. They let systems publish and subscribe to messages in near real time, both inside Salesforce and with external applications.
- You define an event like a custom object, with the suffix __e, and add fields to carry data.
- Events can be published from Apex (
EventBus.publish()), Flow, or external systems through the API. - Subscribers can be Apex triggers on the event, Flows, LWCs (using the empApi module) or external clients through the Pub/Sub API.
- Events are not stored like records; they are delivered to subscribers and kept for a limited replay window.
Common uses include integration with ERP systems, decoupling long processes and logging errors that must survive a transaction rollback.
88. What is a wrapper class in Salesforce?
A wrapper class is a type of container class, which contains a group of objects as its members. It is of an abstract data type.
We use a wrapper class for enclosing the collected data. A wrapper class is defined by a programmer that acts as a custom object, along with wrapper class properties.
The instances of a wrapper class help display various objects in the corresponding table on a Visualforce page.
Some of the main advantages of using wrapper class by developers in Salesforce are given below:
- The wrapper class structure is as efficient as that of a good data visualization process for a web page, especially in the case where the developers are dealing with the JSON structure.
- The developers are not required to manage the passing of any map structure to browse necessary elements. Moreover, the usage of wrapper class by developers will lead to ease in the process of managing relationships between different objects.
- Wrapper class usage prevents any penalty faced by the users for passing an object of Salesforce. Also, it makes the respective object extendable to the constructors of a class.
- The use of the wrapper class supports the developers in efficiently organizing the concerned data, provided the data is properly nested.
89. What is the difference between the insert DML statement and Database.insert()?
insert records;is all-or-nothing. If any record fails, an exception is thrown and the whole operation is rolled back.Database.insert(records, false);allows partial success when the second parameter (allOrNone) is false. Valid records are saved and failed ones are skipped.Database.insert()returns a list ofDatabase.SaveResultobjects, so you can checkisSuccess()andgetErrors()for each record.
Use the DML statement when every record must succeed, and the Database method for bulk loads where you want to save the good records and report the bad ones. The same applies to update, upsert and delete.
90. What is the difference between custom metadata types and custom settings?
Both store configuration data that code and declarative tools can read without SOQL limits, but they behave differently:
- Deployment: custom metadata records are metadata, so they move between orgs with change sets, packages or the Metadata API. Custom settings data must be loaded separately in each org.
- Hierarchy: hierarchy custom settings can hold different values per org, profile or user; custom metadata types have no hierarchy.
- Relationships and use: custom metadata supports relationship fields and can be referenced in formulas, validation rules and Flows.
- Updates: custom settings can be changed with simple DML; custom metadata needs the Metadata API to change records from Apex.
Salesforce generally recommends custom metadata types for app configuration, and hierarchy custom settings when values must vary by user or profile.
Want to download these Salesforce Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version
91. What is a recursive trigger and how do you prevent it?
A recursive trigger is one that fires itself again and again, for example an after-update trigger that updates the same records, which fires the trigger again. This can cause unexpected results or hit the “maximum trigger depth exceeded” limit.
Ways to prevent it:
- Use a static Set<Id> in a helper class to record which records have already been processed in the transaction.
- Compare
Trigger.oldMapwithTrigger.newand act only when the relevant field actually changed. - Do field updates on the same record in a before trigger, which needs no extra DML.
- Use a trigger handler framework with built-in recursion control.
A simple static Boolean flag works but can skip records when more than 200 records are processed in chunks, so a static Set of Ids is safer.
92. What is a Named Credential in Salesforce?
A Named Credential stores the endpoint URL and authentication details of an external system in one place, so Apex and Flow can make callouts without hard-coding usernames, passwords or tokens.
- In Apex you reference it as
callout:My_Named_Credential/pathand Salesforce adds the authentication header automatically. - The current model pairs a Named Credential (the endpoint) with an External Credential (the authentication protocol, such as OAuth 2.0, basic auth or a custom header) and permission sets that grant access.
- You don’t need a separate Remote Site Setting for endpoints called through a Named Credential.
Named Credentials make integrations more secure and easier to move between sandbox and production.
93. Explain the methods of the Batch Apex Class?
The batch apex class deploys the database batchable interface with the three methods as follows:
Start: We use the start method at the beginning of the batch apex job. We use it for collecting the objects or records, for passing them to the interface for executing. It returns a DatabaseQueryLocator object that comprises objects or the records sent to the job.
Finish: We call this method once we finish the batch processing. We use this method to send confirmation emails or to execute the post-processing operations.
Execute: We use this method for every batch of the records that are sent to the method. We use this method for data processing. This method does the following:
- sObjects records list
- Reference to the Database context.
94. What are the different types of Bindings?
Following are the different types of bindings:
- Action Bindings: Action Bindings refers to action methods in the controller.
- Data Bindings: Data Bindings refers to the data sets in the controller.
- Component Bindings: Component Bindings refers to Visualforce components.
95. Explain reRender Attribute Tag?
The reRender attribute defines an elements list that we can update dynamically through the AJAX library of the Salesforce. We do not need the entire page to refresh. Only a part of the page detected by the components is named in the “.rerender” attribute.
96. How can we display the Chatter Feed Record?
By using the <chatter: feed> component, we can display the chatter feed.
Example:
<apex:page>
<chatter: feed entityId=”{!$User.Id}”/>
</apex:page>
97. Explain the Blob variable?
Blob variable is the variable that is intended to gather binary data. tostring() converts the blob back into the string.
string string1=’test string’;
Blob blob = Blob.valueof(myString);
String String2 = myBlob.toString();
System.debug(String2);
98. What is the use of apex:outputLink?
The apex: output link body comprises images or text that we can display in the link.
<apex: outputlink value=”https://mindmajix.com/” id=”theLink”>www.mindmajix.com </apex:outputL
99. What is the Bulkification best practice?
We must avoid using index values like Trigger.New[0] as we never know how many records we get in Trigger.New at runtime.
- We need to use it for each loop whether we have 1 record or many.
- We must not use SOQL inside the loop.
- We must not use SOQL inside the loop.
- We must not use DML inside the loop.
- We need to store data in collections, so our code will work for single as well as multiple records
100. What are the best practices for writing Apex triggers?
- Write one trigger per object and move the logic into a handler class.
- Bulkify the code: always assume Trigger.new can hold up to 200 records.
- Never put SOQL queries or DML statements inside loops; collect Ids in sets and query once.
- Use maps to look up related records efficiently.
- Use before triggers to change fields on the same record, and after triggers for related records or values like the record Id.
- Prevent recursion with static sets or a handler framework.
- Use
addError()for validation messages instead of throwing raw exceptions. - Keep logic out of triggers when a Flow or validation rule is simpler, and avoid mixing several automations on the same event.
- Write test classes with bulk tests (200+ records) and meaningful assertions.
Want to download these Salesforce Interview Questions and Answers in the form of a readable and printable PDF for your interview preparation?
Click the download button below for the PDF version