Top Interview Questions
Salesforce is a cloud-based software company renowned for its Customer Relationship Management (CRM) solutions. Founded in 1999 by Marc Benioff, Parker Harris, Dave Moellenhoff, and Frank Dominguez, Salesforce revolutionized the way businesses manage customer relationships. By offering a robust platform that integrates sales, service, marketing, analytics, and more, Salesforce allows companies to streamline operations, improve customer experiences, and drive business growth.
As a cloud-first company, Salesforce eliminates the need for extensive on-premises infrastructure, enabling businesses of all sizes to access powerful tools via the internet. Its software-as-a-service (SaaS) model ensures scalability, flexibility, and regular updates, making it one of the most widely adopted CRM platforms worldwide.
Salesforce offers a suite of products and services designed to support various aspects of business operations. Some of its core features include:
Sales Cloud:
Sales Cloud is Salesforce’s flagship product, focused on automating and improving sales processes. It helps organizations manage leads, opportunities, accounts, and contacts efficiently. Key features include lead scoring, workflow automation, opportunity tracking, and forecasting. By providing a 360-degree view of customers, Sales Cloud enables sales teams to engage prospects more effectively and close deals faster.
Service Cloud:
Service Cloud is designed to enhance customer service operations. It allows support agents to manage cases, track customer interactions, and provide timely solutions. With features like live chat, knowledge management, and AI-driven chatbots, Service Cloud improves customer satisfaction and reduces response times.
Marketing Cloud:
Marketing Cloud focuses on creating personalized marketing campaigns across multiple channels, including email, social media, and mobile platforms. It enables marketers to analyze customer behavior, segment audiences, and deliver targeted messages, thereby increasing engagement and conversion rates.
Commerce Cloud:
Commerce Cloud is an e-commerce solution that helps businesses deliver seamless shopping experiences online and in-store. It supports features like AI-driven product recommendations, order management, and mobile-first shopping, enabling companies to enhance customer experience and drive sales.
Experience Cloud:
Formerly known as Community Cloud, Experience Cloud allows businesses to create branded portals, forums, and communities for customers, partners, or employees. It promotes collaboration, provides self-service options, and strengthens customer relationships.
Analytics and Einstein AI:
Salesforce Einstein is the AI component of the platform, offering predictive analytics, machine learning, and natural language processing capabilities. Businesses can gain insights from data, forecast trends, and make informed decisions. Analytics tools provide dashboards and reports that track performance metrics across departments.
Integration and AppExchange:
Salesforce offers extensive integration capabilities with third-party applications, ERP systems, and other software platforms. Its marketplace, AppExchange, provides thousands of apps that extend Salesforce functionality, ranging from productivity tools to industry-specific solutions.
Salesforce is built on a multi-tenant cloud architecture, which means that multiple customers (tenants) share the same infrastructure and resources while maintaining data security and privacy. This architecture ensures efficient resource utilization, faster upgrades, and lower operational costs.
The Salesforce platform is divided into several layers:
Application Layer: Provides business applications like Sales Cloud, Service Cloud, Marketing Cloud, and more.
Platform Layer (Force.com): Allows developers to create custom applications using Apex (Salesforce’s proprietary programming language) and Visualforce (framework for building custom UI).
Data Layer: Manages customer and business data securely, supporting relational and non-relational data structures.
User Interface Layer: Offers Lightning Experience, a modern, responsive UI that improves usability across devices.
Salesforce provides numerous benefits that make it a preferred CRM solution for organizations globally:
Centralized Customer Data: Salesforce consolidates all customer information into a single platform, enabling sales, marketing, and support teams to access accurate, real-time data.
Automation of Processes: Workflow automation reduces manual tasks, improves efficiency, and ensures timely follow-ups with customers.
Scalability: Salesforce supports businesses of all sizes, from small startups to multinational corporations. The cloud infrastructure allows easy scaling based on business needs.
Enhanced Collaboration: Salesforce Chatter, the internal collaboration tool, allows employees to communicate, share documents, and collaborate on projects seamlessly.
Customizability: Organizations can tailor Salesforce to meet specific business requirements using custom objects, workflows, and apps.
Mobile Accessibility: Salesforce Mobile App ensures teams can manage customer relationships, track sales, and respond to cases from anywhere.
Data-Driven Insights: Built-in analytics and reporting tools help businesses monitor performance, measure KPIs, and make informed decisions.
Salesforce is highly versatile and caters to a wide range of industries, including:
Financial Services: Streamlines client onboarding, risk management, and financial advisory services.
Healthcare and Life Sciences: Manages patient relationships, care plans, and compliance requirements.
Retail: Enhances customer engagement, manages inventory, and personalizes shopping experiences.
Manufacturing: Supports supply chain management, dealer networks, and customer service operations.
Nonprofit Organizations: Tracks donors, manages fundraising campaigns, and improves stakeholder communication.
The Salesforce ecosystem is extensive and vibrant, comprising developers, administrators, consultants, partners, and communities. Key components include:
Trailhead: Salesforce’s free learning platform provides courses and certifications for users at all levels. Trailhead gamifies learning, making it engaging and interactive.
Salesforce Partners: Consulting and technology partners help businesses implement, customize, and optimize Salesforce solutions.
AppExchange: Offers third-party applications and add-ons that enhance Salesforce’s capabilities.
Community: Salesforce hosts a global community of users and experts who share knowledge, solutions, and best practices.
While Salesforce offers numerous benefits, it also presents certain challenges:
Cost: Salesforce can be expensive, particularly for small businesses with tight budgets.
Complexity: Customization and configuration require skilled administrators or developers.
Learning Curve: New users may need time to adapt to the platform and its extensive functionalities.
Integration Challenges: Integrating Salesforce with legacy systems can sometimes be complex.
Salesforce continues to innovate, investing in AI, automation, and industry-specific solutions. With Salesforce Genie and AI-powered tools, real-time data processing and predictive analytics are becoming more robust. Salesforce’s focus on digital transformation, cloud computing, and customer experience ensures its continued relevance and growth in a competitive market.
1. What is Salesforce?
Salesforce is a cloud-based Customer Relationship Management (CRM) platform that helps businesses manage customer data, sales processes, marketing, and service functions.
2. What are the different types of Salesforce clouds?
Sales Cloud: Manages sales processes.
Service Cloud: Supports customer service management.
Marketing Cloud: Handles marketing campaigns and automation.
Commerce Cloud: E-commerce platform for online stores.
Community Cloud: Builds customer/partner portals.
Analytics Cloud (Tableau CRM): Data analytics and visualization.
App Cloud (Platform): Custom application development.
3. What is CRM?
CRM stands for Customer Relationship Management. It is a system that helps businesses manage interactions with customers, track sales, and improve relationships.
4. What is the difference between Salesforce.com and Salesforce Platform?
Salesforce.com: Refers to the CRM solutions like Sales Cloud, Service Cloud, etc.
Salesforce Platform: Allows developers to build custom apps using tools like Apex, Visualforce, and Lightning.
5. What is Salesforce Lightning?
Lightning is Salesforce’s modern, component-based framework for building responsive applications with an improved UI.
6. What are the differences between Salesforce Classic and Lightning Experience?
| Feature | Classic | Lightning |
|---|---|---|
| UI | Older interface | Modern interface |
| Customization | Limited | Drag-and-drop tools |
| Features | Basic dashboards | Dynamic dashboards, Kanban view |
| Development | Visualforce-based | Lightning Components & App Builder |
7. What is an Org in Salesforce?
An org (organization) is a Salesforce instance that contains data, applications, and users. Every Salesforce customer has their own org.
8. What are Standard Objects?
Objects that come out-of-the-box in Salesforce, such as Account, Contact, Lead, Opportunity, Case, Campaign.
9. What are Custom Objects?
Objects created by users to store data specific to their business needs.
10. What is a Record in Salesforce?
A record is a single instance of an object. For example, a single Account record could represent a specific company.
11. What is a Field in Salesforce?
A field is a data container inside an object. Examples include Name, Email, Phone.
12. What are the types of fields in Salesforce?
Text
Number
Date/Time
Picklist
Checkbox
Lookup Relationship
Master-Detail Relationship
13. What is a Lookup Relationship?
A relationship between two objects where the child object can exist independently of the parent.
14. What is a Master-Detail Relationship?
A strong relationship where the child object’s existence depends on the parent. Deleting the parent deletes the child.
15. What is a Junction Object?
A custom object used to create a many-to-many relationship between two objects.
16. What is a Roll-Up Summary Field?
A field on a master object that aggregates values from related detail records (SUM, MIN, MAX, COUNT).
17. What is an External ID in Salesforce?
A field used as a unique identifier for external data integrations.
18. What is a Formula Field?
A read-only field that automatically calculates values using other fields.
19. What is a Validation Rule?
Rules that enforce data integrity by preventing users from entering invalid data.
20. What is a Record Type?
Record Types allow different business processes, picklist values, and page layouts for the same object.
21. What is Workflow in Salesforce?
Workflow automates standard internal processes. It can trigger Field Updates, Email Alerts, Tasks, and Outbound Messages.
22. What are the limitations of Workflow?
Cannot perform complex logic.
Cannot create records.
Cannot execute actions after a certain condition (like Scheduled Apex).
23. What is Process Builder?
A point-and-click tool that automates business processes. More powerful than Workflow; can create records, update related records, and call Apex.
24. Difference between Workflow and Process Builder:
| Feature | Workflow | Process Builder |
|---|---|---|
| Record creation | No | Yes |
| Multiple criteria | No | Yes |
| Field updates | Limited | Advanced |
| Complex logic | No | Yes |
25. What is Flow in Salesforce?
Flow is a powerful automation tool for guiding users through screens, updating data, creating records, and integrating with external systems.
26. What are the types of Flow?
Screen Flow: Interactive flows with screens for user input.
Autolaunched Flow: Runs in the background automatically.
27. What is Approval Process?
An automation to submit records for approval, assign approvers, and track status.
28. What is a Trigger in Salesforce?
A trigger is Apex code that executes before or after insert, update, delete, or undelete operations on an object.
29. Difference between Trigger and Workflow:
| Feature | Workflow | Trigger |
|---|---|---|
| Complexity | Basic | Advanced |
| Execution | Declarative | Programmatic |
| Actions | Field Update, Email | Any custom logic |
30. What is Apex?
A strongly typed, object-oriented programming language for Salesforce to perform complex business logic.
31. What is a Profile in Salesforce?
Profiles control what users can do in Salesforce (permissions, object access, field-level security).
32. What is a Role in Salesforce?
Roles control what users can see, i.e., data visibility based on hierarchy.
33. What is Sharing Rule?
Rules that extend record access to users based on criteria or roles.
34. What is Organization-Wide Default (OWD)?
The baseline level of access to records for all users.
35. What is Field-Level Security?
Controls access to specific fields for users based on their profile.
36. Difference between Profile and Permission Set:
| Feature | Profile | Permission Set |
|---|---|---|
| Access level | Mandatory | Optional/additional |
| Users | Each user has one profile | Can have multiple |
37. What is a Permission Set?
A collection of permissions that extend users’ access without changing profiles.
38. What is Two-Factor Authentication in Salesforce?
A security process where users provide two forms of identification before accessing Salesforce.
39. What is Login IP Restriction?
Restricting users to login from specific IP ranges.
40. What is Login Hour Restriction?
Restricting users from logging in during specific times.
41. What are Reports in Salesforce?
Reports summarize Salesforce data in tabular, summary, or matrix formats.
42. What are Dashboards in Salesforce?
Visual representation of reports using charts, graphs, and tables.
43. What are Report Types?
Define which objects and fields are available when creating a report. Types: Standard and Custom.
44. What is a Bucket Field?
A field in reports that groups data into categories without creating a formula field.
45. Difference between Summary Report and Matrix Report:
| Feature | Summary | Matrix |
|---|---|---|
| Grouping | Row grouping | Row & Column grouping |
| Use | Simple analysis | Complex cross-tab analysis |
46. What is a Joined Report?
A report combining multiple report blocks to show related information.
47. What is Report Folder Security?
Control who can view or edit reports/dashboards based on folder access.
48. What is a Dynamic Dashboard?
A dashboard that displays data according to the logged-in user’s access.
49. What are Analytic Snapshots (Reporting Snapshots)?
Capture data at regular intervals and store it for trend analysis.
50. Difference between Standard & Custom Report Types:
| Feature | Standard | Custom |
|---|---|---|
| Pre-built | Yes | No |
| Flexibility | Limited | Full control |
51. What is Salesforce AppExchange?
A marketplace to install prebuilt apps, components, and solutions in Salesforce.
52. What is Salesforce1 Mobile App?
Salesforce mobile app to access Salesforce data on smartphones.
53. What is SOQL?
Salesforce Object Query Language to query data from Salesforce objects.
54. What is SOSL?
Salesforce Object Search Language to search text across multiple objects.
55. Difference between SOQL and SOSL:
| Feature | SOQL | SOSL |
|---|---|---|
| Purpose | Query records | Search records |
| Objects | Single object | Multiple objects |
| Return | Specific fields | Full text results |
56. What is API in Salesforce?
Application Programming Interface to integrate Salesforce with external systems.
57. What are different types of Salesforce APIs?
REST API
SOAP API
Bulk API
Streaming API
58. What is Sandbox in Salesforce?
A testing environment that mirrors production data to test apps without affecting live data.
59. Types of Sandboxes:
Developer Sandbox
Developer Pro Sandbox
Partial Copy Sandbox
Full Sandbox
60. Difference between Sandbox and Production:
Sandbox: Test environment.
Production: Live environment.
61. What is Data Loader?
A tool to insert, update, delete, or export Salesforce records in bulk.
62. What is Mass Transfer?
Allows transfer of multiple records (Accounts, Leads, Cases) from one user to another.
63. What is App in Salesforce?
A collection of objects, tabs, and functionalities bundled for a specific business process.
64. What is a Tab in Salesforce?
A UI element representing an object, web page, or Visualforce page.
65. What is Lightning Component?
Reusable component used in Salesforce Lightning framework.
66. What is Visualforce?
A framework to build custom user interfaces in Salesforce using markup language similar to HTML.
67. What is Governor Limit?
Limits imposed by Salesforce to ensure shared resources are not monopolized by a single org. Example: 100 SOQL queries per transaction.
68. What is Platform Event?
A custom event used for real-time integration between Salesforce and external systems.
69. What is Change Set?
A method to deploy metadata (custom objects, fields, triggers) from Sandbox to Production.
70. Difference between Change Set and ANT Migration Tool:
Change Set: Declarative, UI-based deployment.
ANT Tool: Script-based deployment for complex scenarios.
71. What is Lightning App Builder?
A drag-and-drop tool to create custom Lightning pages.
72. What is Einstein Analytics?
AI-powered analytics for predictive insights and recommendations.
73. What is Omni-Channel in Salesforce?
Routes work items like cases, leads, or chats to the right agents automatically.
74. What is Knowledge Base in Salesforce?
A repository of articles to help support agents and customers.
75. Difference between Lead and Opportunity:
| Feature | Lead | Opportunity |
|---|---|---|
| Stage | Prospect | Qualified deal |
| Object type | Standard | Standard |
| Conversion | Can convert to Account/Contact/Opportunity | Cannot convert |
76. What is Campaign in Salesforce?
A marketing initiative to track Leads/Opportunities generated.
77. What is Chatter in Salesforce?
An internal collaboration tool to share updates, files, and follow records.
78. What is Territory Management?
Used to manage sales territories and assign records to the right sales reps.
79. What is Custom Setting?
Custom data accessible across the org without using SOQL. Types: List and Hierarchy.
80. What is Custom Metadata?
Similar to Custom Setting but can be deployed via Change Set and used in Apex.
81. Difference between Workflow, Process Builder, and Flow:
| Feature | Workflow | Process Builder | Flow |
|---|---|---|---|
| Complexity | Low | Medium | High |
| Actions | Email, Task | Record creation, Update | Screen, Decision, Integration |
| UI | Simple | Graphical | Graphical + Programmatic |
82. What is Apex Trigger Best Practice?
Bulkify code to handle multiple records.
Avoid SOQL/DML inside loops.
Use helper classes for logic.
Use context variables like Trigger.isBefore, Trigger.isAfter.
83. What is Test Class in Salesforce?
A class written in Apex to test code functionality and meet deployment requirement (75% code coverage).
84. Difference between Before Trigger and After Trigger:
Before Trigger: Used to update records before saving.
After Trigger: Used to access record IDs and perform actions after saving.
85. What is Schema Builder in Salesforce?
A visual representation of objects, fields, and relationships.
86. What is Global Action?
Actions available across the org to create records, log calls, or send emails.
87. What is Quick Action?
Actions that let users quickly create or update records from a specific object or page layout.
88. Difference between Queue and Assignment Rule:
Queue: Holds records until a user picks them.
Assignment Rule: Automatically assigns records to a user or queue.
89. What is Big Object in Salesforce?
Objects designed to store billions of records for archiving purposes.
90. Difference between Standard Price Book and Custom Price Book:
| Feature | Standard | Custom |
|---|---|---|
| Availability | All products | Specific set of products |
| Creation | Auto-created | User-created |
91. What is Path in Salesforce?
Visual representation of stages in an object (Lead/Opportunity) guiding users through business process.
92. What is Kanban View?
A visual board to manage records like Opportunities in drag-and-drop style.
93. What is Duplicate Management in Salesforce?
Prevents creation of duplicate records using Matching Rules and Duplicate Rules.
94. What is Salesforce DX?
A modern development experience for Salesforce, allowing source-driven development and version control.
95. What is Lightning Web Component (LWC)?
A lightweight, standards-based framework to build reusable UI components.
96. Difference between Aura and LWC:
| Feature | Aura | LWC |
|---|---|---|
| Performance | Slower | Faster |
| Framework | Salesforce proprietary | Web standards based |
| Learning Curve | Easier | Moderate |
97. What is Debug Log in Salesforce?
Used to track Apex execution, errors, and performance for troubleshooting.
98. What is Event Monitoring in Salesforce?
Tracks user activity and system performance for security and auditing.
99. What is Health Check in Salesforce?
Measures org security settings against Salesforce baseline standards.
100. What are Named Credentials?
Stores authentication settings to simplify integration with external systems.
101. What is External Object in Salesforce?
Used to access data stored outside Salesforce via Salesforce Connect.
102. What is Platform Cache?
Stores temporary data for faster access in applications.
103. Difference between Picklist and Multi-Select Picklist:
| Feature | Picklist | Multi-Select Picklist |
|---|---|---|
| Selection | Single | Multiple |
| Storage | One value | Multiple values |
104. Difference between Auto Number and Formula Field:
| Feature | Auto Number | Formula Field |
|---|---|---|
| Value | Automatically generated | Calculated |
| Editable | No | No |
105. What is Change Data Capture (CDC)?
Tracks changes in Salesforce records in real-time for integration or event-driven apps.
Q1. What are the different types of objects in Salesforce?
Answer:
Standard Objects: Predefined objects by Salesforce, e.g., Account, Contact, Opportunity, Case.
Custom Objects: Created by users to store data specific to the business.
External Objects: Used for accessing data stored outside Salesforce via Salesforce Connect.
Big Objects: Used to store massive amounts of data without affecting performance.
Q2. Explain the difference between a role and a profile.
Answer:
Profile: Determines what a user can do (object permissions, field-level security, page layouts). Each user has one profile.
Role: Determines what data a user can see (record-level access). Roles are hierarchical; managers can see subordinates’ data.
Q3. What is a Salesforce Governor Limit?
Answer: Salesforce enforces governor limits to ensure efficient use of resources in a multitenant environment.
Examples:
Max 100 SOQL queries per transaction
Max 150 DML operations per transaction
Max CPU time of 10,000ms per transaction
Q4. What is Apex and how is it different from Java?
Answer:
Apex is Salesforce’s proprietary, strongly typed, object-oriented programming language similar to Java.
Differences:
Apex runs on the Salesforce server, enforcing governor limits.
Java allows infinite CPU/memory; Apex is multitenant-aware.
Apex has built-in support for DML, SOQL, and SOSL.
Q5. Explain the different types of collections in Apex.
Answer:
List: Ordered collection. Allows duplicates.
Set: Unordered, unique elements.
Map: Key-value pairs; keys are unique.
Q6. What is the difference between trigger.new and trigger.old?
Answer:
trigger.new: List of new versions of sObjects for insert/update events.
trigger.old: List of old versions of sObjects for update/delete events.
Use trigger.newMap and trigger.oldMap for easy access by record Id.
Q7. How do you handle bulk operations in Apex triggers?
Answer:
Avoid SOQL/DML inside loops.
Use collections to accumulate data.
Example pattern:
List<Contact> contactsToUpdate = new List<Contact>();
for(Account acc : Trigger.new){
if(acc.Name != Trigger.oldMap.get(acc.Id).Name){
contactsToUpdate.add(new Contact(AccountId = acc.Id));
}
}
update contactsToUpdate;
Q8. What is @future in Apex?
Answer:
Asynchronous method to run processes in the background.
Useful for callouts or time-consuming tasks.
Limit: Max 50 calls per transaction.
Q9. Difference between Lightning Component and Aura Component
Answer:
| Feature | Aura Component | Lightning Web Component (LWC) |
|---|---|---|
| Framework | Proprietary | Modern Web Standards |
| Performance | Slower | Faster |
| Reusability | Less | High |
| Syntax | Proprietary | JavaScript, HTML, CSS |
| Testing | Manual | Jest, standard tools |
Q10. What is a Lightning Data Service?
Answer:
Enables components to read and modify Salesforce records without Apex.
Handles sharing rules, field-level security automatically.
Reduces code complexity and governor limits.
Q11. What are the types of Salesforce integration?
Answer:
SOAP API: Enterprise and Partner WSDL for structured integration.
REST API: Lightweight, JSON/ XML-based integration.
Bulk API: For mass data operations asynchronously.
Streaming API: Real-time event notifications (PushTopic, Platform Events).
Outbound Messaging: Part of workflow automation.
Q12. Explain the difference between a REST API and SOAP API
Answer:
| Feature | REST API | SOAP API |
|---|---|---|
| Protocol | HTTP | SOAP |
| Payload | JSON/XML | XML only |
| Complexity | Simple | Complex |
| Use Case | Mobile/Web apps | Enterprise integrations |
Q13. What is sharing rule in Salesforce?
Answer:
Sharing rules allow automatic record access to users based on criteria or ownership.
Types:
Owner-based sharing (based on role or group)
Criteria-based sharing (records meeting criteria)
Q14. Difference between Role Hierarchy and Sharing Rules
Answer:
Role Hierarchy: Automatic upward sharing (managers see subordinates’ data).
Sharing Rules: Grant access horizontally to users at same or different hierarchy.
Q15. What is field-level security vs page layout security?
Answer:
Field-level security: Controls if a user can view or edit a field.
Page layout: Controls visibility of fields on the UI only, but cannot restrict API access.
Q16. How do you handle data migration in Salesforce?
Answer:
Tools: Data Loader, Data Import Wizard, ETL tools like Informatica or Talend.
Steps:
Extract data from source.
Cleanse and transform data.
Import in proper order (parent objects first).
Validate via reports/queries.
Q17. Difference between Sandbox types
Answer:
| Sandbox Type | Purpose | Data Copy |
|---|---|---|
| Developer | Code/Config Dev | No Production data |
| Developer Pro | Larger Dev | Limited Prod data |
| Partial Copy | QA/Testing | Subset of Prod data |
| Full | UAT / Prod-like Testing | Full Prod data |
Q18. What is a Change Set?
Answer:
Declarative way to deploy metadata between orgs.
Components: Apex Classes, Triggers, Objects, Fields, Profiles, Permission Sets.
Limitation: Only works between related orgs (Prod → Sandbox, Sandbox → Sandbox).
Q19. What is Platform Event?
Answer:
Custom event in Salesforce for event-driven architecture.
Producers publish events, subscribers receive them asynchronously.
Useful for decoupled system integrations.
Q20. Explain SOSL vs SOQL
Answer:
SOQL: Like SQL, query Salesforce objects (1 object at a time usually).
SOSL: Search across multiple objects, fields; returns list of records.
Q21. Explain Order of Execution in Salesforce
Answer:
Load Original Record
Before Triggers
Validation Rules
After Triggers
Assignment Rules
Auto-response Rules
Workflow Rules
Escalation Rules
Roll-up Summary / DML Commit
Post-commit logic (Emails, Callouts, etc.)
Q22. How do you handle governor limits in Salesforce?
Answer:
Bulkify triggers.
Use collections instead of DML/SOQL inside loops.
Use @future, Queueable, Batchable for async processing.
Use indexing on fields in SOQL queries.
Q23. How do you update child records when parent record changes?
Use trigger on parent object. Bulkify logic with a Map<Id, List>.
Q24. Scenario: A workflow is not firing on a record update.
Check criteria, evaluation criteria, field-level security, order of execution, or record type.
Q25. How to handle large data volumes for processing?
Use Batch Apex, Scheduled Apex, or Bulk API.
Avoid synchronous triggers for large imports.
Q26. What are the different types of triggers in Salesforce?
Answer:
Before triggers: Used to update or validate record values before saving to the database.
After triggers: Used to access field values that are set by the system and to make changes in other records.
Bulk Triggers: Always design triggers to handle bulk records (up to 200 records per batch).
Recursive Trigger Handling: Use static variables in helper classes to prevent triggers from running recursively.
Q27. How do you handle recursion in triggers?
Answer:
Recursion can occur when a trigger updates a record that fires the same trigger again.
Solution: Use a static Boolean variable in a helper class.
public class TriggerHelper {
public static Boolean isTriggerExecuted = false;
}
trigger AccountTrigger on Account (before update) {
if(!TriggerHelper.isTriggerExecuted){
TriggerHelper.isTriggerExecuted = true;
// Your logic here
}
}
Q28. What is Batch Apex and when would you use it?
Answer:
Batch Apex allows processing large datasets asynchronously.
Interface: Database.Batchable<SObject>
Use cases:
Mass data updates (millions of records)
Data cleansing
Scheduled processes for large records
global class AccountBatch implements Database.Batchable<SObject> {
global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator([SELECT Id FROM Account]);
}
global void execute(Database.BatchableContext BC, List<Account> scope){
for(Account acc: scope){
acc.Description = 'Updated via batch';
}
update scope;
}
global void finish(Database.BatchableContext BC){
// Post-processing
}
}
Q29. Explain Queueable Apex vs Future Methods
Answer:
| Feature | @future | Queueable Apex |
|---|---|---|
| Async | Yes | Yes |
| Chaining | No | Yes |
| Complex objects | No | Yes |
| Job ID | Not returned | Can get Job ID for tracking |
| Use case | Callouts, simple async | Complex async with chaining |
Q30. What is Lightning Web Component (LWC)?
Answer:
Modern UI framework based on Web Standards (HTML, JS, CSS).
Benefits: Lightweight, faster performance, better security, and easier testing.
Q31. How do you call Apex from LWC?
Use @AuraEnabled Apex methods:
@AuraEnabled(cacheable=true)
public static List<Account> getAccounts() {
return [SELECT Id, Name FROM Account];
}
Import in JS:
import getAccounts from '@salesforce/apex/AccountController.getAccounts';
Q32. What is the difference between Aura and LWC events?
Aura: Component events (bubble) and Application events (global).
LWC: Custom events, handled via dispatchEvent and addEventListener.
Q33. What is the difference between REST and SOAP API?
Already discussed, but add real-world scenario:
REST API is preferred for mobile apps or lightweight integrations.
SOAP API is preferred for enterprise integrations requiring strict schema validation.
Q34. What is an Outbound Message in Salesforce?
Used in Workflow or Process Builder to send SOAP messages to external systems.
Fire-and-forget approach; asynchronous.
Q35. What are Platform Events and how are they used?
Event-driven architecture in Salesforce.
Components: Event Publisher (creates event), Subscriber (receives event).
Use cases:
Syncing Salesforce with external systems in near real-time
Decoupled integrations
Q36. What is Salesforce DX?
Modern development tool for source-driven development, version control, and CI/CD.
Benefits:
Manage multiple orgs easily
Automated deployments
Package-based development
Q37. How do you migrate metadata between Salesforce orgs?
Tools: Change Sets, ANT Migration Tool, Salesforce CLI, 3rd-party tools (Copado, Gearset).
Best practices:
Deploy to sandbox first, test, then deploy to production
Maintain version control
Q38. What are unlocked packages in Salesforce?
Metadata bundles for modular development and deployment.
Advantages: Reusable, easier to manage dependencies, compatible with Salesforce DX.
Q39. Scenario: Trigger should update child records on parent update but avoid recursion.
Solution:
Use static variable in a helper class.
Bulkify code: Collect child records in a Map<Id, List> and perform single DML.
Q40. Scenario: Data import of 1 million records fails due to governor limits.
Solution:
Use Batch Apex or Bulk API.
Avoid synchronous triggers.
Q41. Best practices for Apex and Triggers:
Bulkify all code
Avoid SOQL/DML inside loops
Use Helper classes for logic separation
Use Custom Settings / Custom Metadata for configurable parameters
Handle recursion with static variables
Q42. How do you handle error logging in Salesforce?
Options:
Custom Object for logs
Platform Events for async error tracking
Try-Catch in Apex with detailed logging
Q43. What is the difference between Roll-Up Summary and Process Builder/Flow
Roll-Up Summary: Declarative, only works with Master-Detail relationships.
Process Builder / Flow: Can calculate across lookup relationships, more flexible.
Q44. How to handle duplicate data in Salesforce?
Use Duplicate Rules and Matching Rules
Use Data.com / Third-party data cleansing tools
Q45. What is the difference between SOQL and SOSL with examples?
SOQL: Query single object with conditions.
SELECT Id, Name FROM Account WHERE Industry='Banking'
SOSL: Search across multiple objects.
FIND 'Acme*' IN ALL FIELDS RETURNING Account(Id, Name), Contact(Id, Name)