Salesforce Basics
1. What is Salesforce, and why is it used?
Answer
Salesforce is a cloud-based Customer Relationship Management (CRM) platform that helps businesses manage customers, sales, marketing, service, and business processes from a single platform.
Instead of installing software on local computers, Salesforce runs on the cloud, allowing users to access it anytime from anywhere.
Salesforce follows the Software as a Service (SaaS) model, meaning customers simply log in through a web browser without worrying about servers, hardware, or software updates.
Why is Salesforce used?
Companies use Salesforce because it helps them:
- Store customer information in one place
- Track leads and sales opportunities
- Automate business processes
- Improve customer support
- Build custom applications
- Generate reports and dashboards
- Integrate with external systems
- Increase productivity
Real-world Example
Imagine a customer submits a request for a product.
Without Salesforce:
- Customer data is stored in Excel.
- Sales team uses emails.
- Support uses another software.
Result:
- Duplicate work
- Lost information
- Poor customer experience
With Salesforce:
Everything is stored in one platform:
Customer → Lead → Opportunity → Account → Contact → Order → Support Case
Every department works using the same customer data.
Features
- Cloud-based
- Highly customizable
- Secure
- Mobile-friendly
- AI-powered (Agentforce & Einstein)
- Automation using Flow
- Reports & Dashboards
- APIs for integration
Interview Tip
Salesforce is not just CRM software.
It is also an application development platform called the Salesforce Platform, where developers can build custom applications using Apex, Lightning Web Components (LWC), Flows, APIs, and more.
2. What is CRM?
Answer
CRM stands for Customer Relationship Management.
CRM is a strategy and software used by organizations to manage interactions with current and potential customers throughout their lifecycle.
The goal is to improve customer relationships, increase sales, and provide better customer service.
CRM manages
- Customer Information
- Sales
- Marketing
- Customer Support
- Communication History
- Purchase History
Real-world Example
Suppose a customer buys a laptop.
CRM stores:
- Name
- Phone
- Purchase Date
- Warranty
- Previous conversations
- Support tickets
When the customer calls again, the support agent immediately sees all previous interactions.
Benefits
- Better customer experience
- Faster support
- Increased sales
- Customer retention
- Better communication
- Data-driven decisions
Types of CRM
Operational CRM
Focuses on
- Sales
- Marketing
- Service
Example:
Salesforce Sales Cloud
Analytical CRM
Analyzes customer data.
Example:
- Reports
- Dashboards
- Predictions
Collaborative CRM
Helps teams collaborate.
Example:
Sales + Support + Marketing use the same customer data.
Interview Tip
CRM is both:
- A business strategy
- Software that implements the strategy
Salesforce is one of the world’s leading CRM platforms.
3. What are the different Salesforce Clouds?
Answer
A Salesforce Cloud is a collection of features designed for a specific business function.
Popular Salesforce Clouds
1. Sales Cloud
Used by Sales Teams.
Features
- Leads
- Accounts
- Contacts
- Opportunities
- Quotes
- Forecasting
Example:
Managing the entire sales pipeline.
2. Service Cloud
Used by Customer Support.
Features
- Cases
- Omni-Channel
- Knowledge Base
- Live Chat
- Email-to-Case
Example:
Managing customer complaints.
3. Marketing Cloud
Used for digital marketing.
Features
- Email campaigns
- SMS
- Customer journeys
- Personalization
4. Experience Cloud
Creates customer and partner portals.
Example:
Partner Portal
Customer Community
5. Commerce Cloud
Builds eCommerce websites.
Supports:
- Online shopping
- Product catalog
- Checkout
6. Data Cloud
Unifies customer data from multiple systems.
Supports:
- Customer 360
- AI
- Personalization
7. Health Cloud
Used by hospitals.
Stores:
- Patient information
- Medical history
8. Financial Services Cloud
Used by banks and insurance companies.
9. Education Cloud
Used by universities.
10. Nonprofit Cloud
Used by NGOs.
11. Agentforce
AI-powered digital workforce for:
- Sales
- Service
- Support
- Employee assistance
Interview Tip
Sales Cloud and Service Cloud are the most commonly used in interviews.
4. What is the difference between Salesforce Classic and Lightning Experience?
| Feature | Salesforce Classic | Lightning Experience |
|---|---|---|
| UI | Old | Modern |
| Performance | Basic | Faster |
| Mobile Support | Limited | Excellent |
| Reports | Basic | Advanced |
| Dashboard | Simple | Interactive |
| AI Features | No | Yes |
| Lightning Components | No | Yes |
| Dynamic Forms | No | Yes |
| Path | No | Yes |
| Kanban View | No | Yes |
| Future Updates | Very Limited | Full Support |
Lightning Experience Advantages
- Better user experience
- Drag-and-drop components
- Dynamic Pages
- AI integration
- Better productivity
Interview Tip
Almost all new Salesforce development is done using Lightning Experience.
Classic is mostly maintained for legacy organizations.
5. Explain the Salesforce Multitenant Architecture.
Answer
Salesforce follows a Multitenant Architecture.
This means multiple customers (called tenants) share the same infrastructure while keeping their data completely isolated and secure.
Real-world Example
Think of an apartment building.
The building is shared.
Every family has:
- Separate rooms
- Separate locks
- Separate electricity bills
Although everyone lives in the same building, nobody can access another family’s apartment.
Salesforce works similarly.
Benefits
- Lower cost
- Automatic upgrades
- High availability
- Better scalability
- Strong security
- No server maintenance
Diagram
Salesforce Server
-------------------------
Organization A
-------------------------
Organization B
-------------------------
Organization C
-------------------------
Same Infrastructure
Separate Data
Interview Tip
Every Salesforce customer has its own Org, but all Orgs run on Salesforce’s shared infrastructure.
6. What are Standard Objects and Custom Objects?
Standard Objects
These are objects provided by Salesforce.
Examples:
- Account
- Contact
- Lead
- Opportunity
- Case
- Task
- Campaign
- Product
- User
They cannot be deleted.
Custom Objects
Objects created by developers or admins.
Example:
Hospital
- Patient
- Doctor
- Appointment
School
- Student
- Teacher
- Course
Custom Object API names end with:
__c
Example
Student__c
Comparison
| Standard Object | Custom Object |
|---|---|
| Provided by Salesforce | Created by Admin |
| Cannot delete | Can delete |
| Fixed functionality | Custom functionality |
| No __c | Ends with __c |
Interview Tip
Standard Objects handle common business processes, while Custom Objects are created for organization-specific requirements.
7. What are Standard Fields and Custom Fields?
Standard Fields
Fields already available in Salesforce.
Examples
- Name
- Owner
- Created Date
- Last Modified Date
- Phone
Custom Fields
Created by developers or admins.
Example
Employee Object
Custom Fields
- Salary__c
- Joining_Date__c
- PAN_Number__c
Custom field API names also end with
__c
Field Types
- Text
- Number
- Currency
- Date
- Date/Time
- Checkbox
- Picklist
- Formula
- Lookup
- Master-Detail
- URL
- Phone
- Auto Number
Comparison
| Standard Field | Custom Field |
|---|---|
| Built-in | User Created |
| Cannot delete | Can delete |
| No __c | Ends with __c |
8. What is an App in Salesforce?
Answer
A Salesforce App is a collection of related tabs, objects, pages, and functionality designed for a specific business purpose.
It helps users quickly access all the tools they need for a particular job.
Examples
Sales App
Contains:
- Leads
- Accounts
- Contacts
- Opportunities
Service App
Contains:
- Cases
- Knowledge
- Omni Channel
Recruitment App
Contains:
- Candidate
- Interview
- HR
- Offer
Types
- Standard Apps
- Custom Apps
Interview Tip
An App does not store data; it simply organizes related objects, tabs, and features into a single workspace.
9. What is a Record Type?
Answer
A Record Type allows different business processes, picklist values, and page layouts for the same object.
It enables organizations to customize how different teams work with the same object.
Real-world Example
Opportunity Object
Sales Team:
Stages
- Prospecting
- Qualification
- Proposal
Support Team:
Stages
- Investigation
- Pending Customer
- Closed
Different users see different values based on the Record Type.
Record Type Controls
- Business Process
- Picklist Values
- Page Layout
- User Experience
Example
Case Object
Customer Support
Fields:
- Product
- Severity
IT Support
Fields:
- Server Name
- IP Address
Both use the Case object but have different Record Types.
Interview Tip
Record Types are commonly used when multiple departments share the same object but require different business processes or page layouts.
10. What are Page Layouts?
Answer
A Page Layout controls how fields, buttons, related lists, and actions are displayed on a record page.
It determines what users see and interact with when they open a record.
Page Layout controls
- Fields
- Buttons
- Related Lists
- Quick Actions
- Sections
- Mobile Actions
Example
Sales Team Page Layout
Shows:
- Opportunity Amount
- Stage
- Competitors
Support Team Page Layout
Shows:
- Case Priority
- Product
- Resolution
Important Point
Page Layout controls visibility and editability of fields on the UI, but it does not provide security.
For actual data security, use:
- Field-Level Security (FLS)
- Profiles
- Permission Sets
Interview Tip
A common interview question is: “Can Page Layout hide a field from users?”
Answer: No. It only hides the field on that layout. If the user has Field-Level Security access, the field can still be accessed through reports, APIs, or other layouts. Use Field-Level Security to truly restrict access.
Quick Interview Summary
| Question | One-line Answer |
|---|---|
| What is Salesforce? | A cloud-based CRM and application platform. |
| What is CRM? | A system for managing customer relationships and business interactions. |
| Salesforce Clouds | Collections of features for different business functions like Sales, Service, and Marketing. |
| Classic vs Lightning | Lightning is the modern, feature-rich interface replacing Classic. |
| Multitenant Architecture | Multiple organizations share the same infrastructure while keeping data isolated. |
| Standard vs Custom Objects | Standard are built-in; Custom are created to meet business-specific needs. |
| Standard vs Custom Fields | Standard are provided by Salesforce; Custom are user-created and end with __c. |
| App | A collection of related objects, tabs, and features for a business function. |
| Record Type | Allows different business processes, page layouts, and picklist values on the same object. |
| Page Layout | Controls the UI layout of records, including fields, buttons, and related lists. |
Security & Data Model
1. What is the difference between Profiles and Permission Sets?
Answer
Both Profiles and Permission Sets are used to control what a user can do in Salesforce, but they serve different purposes.
- A Profile is the base level of access assigned to every user. Every user must have exactly one Profile.
- A Permission Set provides additional permissions on top of the user’s Profile. A user can have multiple Permission Sets.
Think of it this way:
- Profile = Minimum required access
- Permission Set = Extra access when needed
Profile Controls
A Profile determines:
- Object permissions (Create, Read, Edit, Delete)
- Field-Level Security
- App access
- Record Types
- Page Layout assignments
- Login hours
- Login IP ranges
- Apex Class access
- Visualforce Page access
- Tab visibility
Permission Set Controls
A Permission Set can grant:
- Additional object permissions
- Additional field permissions
- Apex Class access
- Flow access
- App access
- Custom permissions
- System permissions
A Permission Set cannot remove permissions already granted by the Profile. It can only add access.
Real-World Example
A company has 100 Sales Users.
Everyone gets the Sales User Profile.
One sales representative temporarily needs access to the Campaign object.
Instead of creating another Profile:
- Create a Permission Set.
- Give Campaign access.
- Assign it only to that user.
When the project ends, simply remove the Permission Set.
Key Differences
| Profile | Permission Set |
|---|---|
| Mandatory | Optional |
| One per user | Multiple per user |
| Base access | Additional access |
| Controls login hours/IP | Does not control login hours/IP |
| Can restrict access | Only grants additional access |
| Assigned during user creation | Assigned anytime |
Interview Tip
Always use Permission Sets instead of creating multiple Profiles when only a few users need extra permissions. This follows Salesforce best practices and simplifies administration.
2. Explain Organization-Wide Defaults (OWD)
Answer
Organization-Wide Defaults (OWD) define the default level of record access for users in Salesforce.
OWD answers the question:
“If no other sharing mechanism exists, who can access this record?”
It is the foundation of Salesforce’s record-level security model.
OWD Access Levels
Private
- Only the record owner and users above them in the role hierarchy can access the record (unless additional sharing is configured).
Public Read Only
- Everyone can view records.
- Only the owner (or users with additional permissions) can edit them.
Public Read/Write
- Everyone can view and edit records.
Controlled by Parent
- Child object access is inherited from the parent object.
Example
Suppose there are two Sales Representatives:
- Amit
- Rahul
OWD for Opportunity = Private
Amit creates an Opportunity.
Rahul cannot see it unless access is granted through Role Hierarchy, Sharing Rules, Manual Sharing, Teams, etc.
Why OWD is Important
Salesforce recommends starting with the most restrictive access (Private) and opening access only where needed using other sharing mechanisms.
Interview Tip
Record access in Salesforce is typically granted in this order:
- OWD
- Role Hierarchy
- Sharing Rules
- Manual Sharing
- Teams/Territories
3. What is Role Hierarchy?
Answer
A Role Hierarchy allows users higher in the organizational hierarchy to automatically access records owned by users below them.
It reflects the reporting structure of a company.
Roles do not grant object permissions. They only provide record visibility.
Example
CEO
│
Sales Director
│
Sales Manager
│
Sales Executive
If OWD is Private:
- Sales Executive owns an Opportunity.
- Sales Manager can see it.
- Sales Director can see it.
- CEO can see it.
The reverse is not true.
Benefits
- Automatic record sharing
- Reflects organizational reporting
- Reduces manual sharing
- Easy to maintain
Profile vs Role
| Profile | Role |
|---|---|
| Controls what users can do | Controls which records users can see |
| Mandatory | Optional |
| Object-level access | Record-level access |
Interview Tip
A common misconception is that Roles give object permissions. They do not—they only affect record visibility.
4. What are Sharing Rules?
Answer
Sharing Rules are used to automatically share records with groups of users when OWD is more restrictive than required.
They extend access but never restrict access.
Types of Sharing Rules
Owner-Based Sharing Rule
Shares records based on the record owner.
Example:
Share all Opportunities owned by the Sales Team with the Marketing Team.
Criteria-Based Sharing Rule
Shares records based on field values.
Example:
Share all Cases where Priority = High with the Support Managers.
Real-World Example
OWD for Account = Private
All Accounts where Country = India should be visible to the India Sales Team.
Create a Criteria-Based Sharing Rule.
Interview Tip
Sharing Rules only grant additional access. They cannot make records more private.
5. What is Field-Level Security (FLS)?
Answer
Field-Level Security controls whether a user can see or edit a specific field on an object.
It provides true field-level data security.
FLS Permissions
- Visible
- Read Only
- Hidden
Example
Employee Object
Fields:
- Name
- Salary
- PAN Number
HR users:
- Can see Salary
Sales users:
- Cannot see Salary
Even if Sales users have access to the Employee record, FLS hides the Salary field.
Page Layout vs FLS
| Page Layout | FLS |
|---|---|
| UI visibility | Actual security |
| Can hide fields on a page | Prevents access everywhere (UI, Reports, APIs) |
| Not secure | Secure |
Interview Tip
If a field must be protected, always use Field-Level Security, not just Page Layouts.
6. What is the difference between Lookup and Master-Detail relationships?
Answer
Both are relationships between objects, but they differ in how tightly the objects are connected.
Lookup Relationship
A loose relationship.
- Parent and child are independent.
- Child record can exist without a parent.
- Deleting the parent does not automatically delete the child.
- Roll-Up Summary Fields are not supported.
Example
Employee → Department
An Employee may or may not belong to a Department.
Master-Detail Relationship
A tightly coupled relationship.
- Child cannot exist without a parent.
- Parent controls ownership and sharing.
- Deleting the parent automatically deletes child records (cascade delete).
- Roll-Up Summary Fields are supported.
Example
Order → Order Items
An Order Item cannot exist without an Order.
Comparison
| Lookup | Master-Detail |
|---|---|
| Loose relationship | Strong relationship |
| Child can exist alone | Child requires parent |
| No cascade delete | Cascade delete |
| Separate ownership | Parent controls ownership |
| No Roll-Up Summary | Roll-Up Summary supported |
| Optional by default | Parent is required |
Interview Tip
Use Master-Detail when the child record has no meaning without the parent. Use Lookup when the relationship is optional or independent.
7. What is a Junction Object?
Answer
A Junction Object is a custom object that creates a many-to-many relationship between two objects.
It contains two Master-Detail relationships, one to each parent object.
Real-World Example
Students can enroll in many Courses.
Courses can have many Students.
This is a many-to-many relationship.
Create:
- Student (Object)
- Course (Object)
- Enrollment (Junction Object)
Enrollment has:
- Student (Master-Detail)
- Course (Master-Detail)
Benefits
- Supports many-to-many relationships
- Stores additional information (e.g., Enrollment Date, Grade)
- Enables reporting across both parent objects
Interview Tip
A Junction Object is always a custom object with two Master-Detail relationships.
8. What is Schema Builder?
Answer
Schema Builder is a visual design tool in Salesforce that allows administrators and developers to view and manage the data model.
It displays objects, fields, and relationships in a graphical format.
What You Can Do
- Create custom objects
- Create custom fields
- Define relationships
- View object relationships
- Understand the overall data model
Benefits
- Easy visualization
- Faster data model design
- Better understanding of relationships
- Drag-and-drop interface
Real-World Example
Suppose you are designing a Hospital Management System.
Using Schema Builder, you can visually connect:
- Patient
- Doctor
- Appointment
- Prescription
This makes the data model easier to understand than viewing each object individually.
Interview Tip
Schema Builder is mainly a visual modeling tool. It helps design and understand the schema but is not typically used for advanced administration tasks.
9. What are Validation Rules?
Answer
Validation Rules ensure that data entered into Salesforce meets specific business requirements before a record is saved.
If the data does not meet the rule, Salesforce displays an error message and prevents the record from being saved.
Why Use Validation Rules?
- Improve data quality
- Enforce business policies
- Prevent incorrect or incomplete data
- Reduce manual data cleanup
Real-World Example
A company requires every Opportunity marked Closed Won to have an Amount greater than zero.
Validation Rule logic:
AND(
ISPICKVAL(StageName, "Closed Won"),
Amount <= 0
)
Error Message:
Amount must be greater than 0 before closing the Opportunity.
Common Functions Used
- ISBLANK()
- ISPICKVAL()
- AND()
- OR()
- NOT()
- ISCHANGED()
- PRIORVALUE()
- REGEX()
Interview Tip
Validation Rules run before the record is saved and help maintain data integrity without writing Apex code.
10. What are Formula Fields?
Answer
A Formula Field is a read-only field that automatically calculates its value based on a formula.
The value is calculated in real time whenever the record is viewed, so no data is physically stored in the database.
Advantages
- No Apex code required
- Automatically updates
- Reduces manual calculations
- Can reference fields on related records (depending on relationships)
Examples
Full Name
FirstName & " " & LastName
Annual Salary
Monthly_Salary__c * 12
Discounted Price
Price__c - (Price__c * Discount__c / 100)
Adult Check
Age__c >= 18
Returns TRUE or FALSE.
Formula Return Types
- Text
- Number
- Currency
- Percent
- Checkbox
- Date
- Date/Time
Formula Field vs Roll-Up Summary Field
| Formula Field | Roll-Up Summary Field |
|---|---|
| Performs calculations using formulas | Aggregates child records |
| Works on most objects | Requires a Master-Detail relationship |
| Examples: Total Price, Full Name | Examples: SUM, COUNT, MIN, MAX of child records |
Interview Tip
Formula Fields are read-only, calculated dynamically, and ideal for business calculations that should always reflect the latest data without storing duplicate values.
Quick Interview Summary
| Question | One-line Answer |
|---|---|
| Profiles vs Permission Sets | Profile provides base access (one per user); Permission Sets add extra permissions (many per user). |
| Organization-Wide Defaults (OWD) | Defines the default record access level across the organization. |
| Role Hierarchy | Grants record visibility upward in the organizational hierarchy. |
| Sharing Rules | Automatically share records to expand access beyond OWD. |
| Field-Level Security (FLS) | Controls visibility and editability of individual fields. |
| Lookup vs Master-Detail | Lookup is a loose relationship; Master-Detail is a strong parent-child relationship with shared ownership and roll-up support. |
| Junction Object | A custom object with two Master-Detail relationships used to model many-to-many relationships. |
| Schema Builder | A visual tool for creating and viewing objects, fields, and relationships. |
| Validation Rules | Enforce business rules and prevent invalid data from being saved. |
| Formula Fields | Read-only fields that calculate values dynamically using formulas. |
Automation
1. What is Salesforce Flow?
Answer
Salesforce Flow is Salesforce’s low-code/no-code automation tool that allows administrators and developers to automate business processes without writing Apex code.
Flow can:
- Create records
- Update records
- Delete records
- Send Emails
- Call Apex
- Call REST APIs
- Display Screens
- Make Decisions
- Loop through records
- Schedule actions
- Invoke Subflows
Salesforce recommends Flow as the primary automation tool because Workflow Rules and Process Builder are being retired.
Why is Flow Used?
Instead of manually performing repetitive tasks, Flow automates them.
Examples:
- Automatically create a Task when a Lead is created.
- Send an email when an Opportunity is Closed Won.
- Update related records.
- Calculate discounts.
- Approve requests.
- Integrate with external systems.
Real-World Example
Scenario: Employee Onboarding
When an HR user creates an Employee record:
Flow automatically:
- Creates a User.
- Assigns Permission Sets.
- Creates onboarding Tasks.
- Sends a welcome email.
- Creates an Asset record for the laptop.
- Notifies the IT team.
Without Flow, HR would perform all these tasks manually.
Components of a Flow
- Start – Defines how the Flow begins.
- Get Records – Retrieves records from Salesforce.
- Create Records – Creates new records.
- Update Records – Updates existing records.
- Delete Records – Deletes records.
- Decision – Adds IF/ELSE logic.
- Assignment – Assigns values to variables.
- Loop – Iterates through collections.
- Screen – Displays UI for user input.
- Action – Calls Apex, sends emails, posts to Chatter, etc.
- Subflow – Reuses another Flow.
Advantages
- No coding required for most use cases.
- Supports complex automation.
- Easy to maintain.
- Reusable.
- Can call Apex when needed.
- Recommended by Salesforce.
Interview Tip
If asked, “What automation tool should be used in Salesforce today?”, answer:
Salesforce Flow, because Workflow Rules and Process Builder are being phased out.
2. What are the different types of Flows?
Answer
Salesforce provides several types of Flows for different automation needs.
1. Record-Triggered Flow
Runs automatically when a record is created, updated, or deleted.
Can run:
- Before Save
- After Save
Example:
When an Opportunity is marked Closed Won, automatically create a Contract.
Before-Save Flow
Runs before the record is committed to the database.
Best for:
- Updating fields on the same record.
Benefits:
- Faster than Apex triggers.
- No extra DML.
Example:
Automatically set the Account Rating to Hot.
After-Save Flow
Runs after the record is saved.
Best for:
- Creating related records.
- Sending emails.
- Updating other objects.
- Calling external APIs.
Example:
Create a Case after an Order is delivered.
2. Screen Flow
Provides a user interface with screens.
Users enter information, and the Flow performs actions.
Example:
Employee Leave Request Form.
3. Scheduled-Triggered Flow
Runs automatically at a specified date and time.
Example:
Every night at 12:00 AM:
- Close expired Cases.
- Send reminders.
- Archive records.
4. Platform Event-Triggered Flow
Runs when a Platform Event is received.
Used for:
- Integrations.
- Event-driven architecture.
- Asynchronous processing.
5. Autolaunched Flow
Runs without user interaction.
Can be called from:
- Apex
- Process Builder (legacy)
- REST API
- Subflow
- Quick Actions
6. Orchestrator (Flow Orchestration)
Coordinates multiple Flows and approval steps across departments.
Example:
Employee onboarding across HR, IT, and Finance.
Summary Table
| Flow Type | Runs When | Example |
|---|---|---|
| Record-Triggered | Record changes | Update Account after Opportunity closes |
| Screen Flow | User interaction | Loan application form |
| Scheduled Flow | On schedule | Daily cleanup job |
| Platform Event Flow | Platform Event received | External system notification |
| Autolaunched Flow | Called by another process | Reusable business logic |
| Flow Orchestration | Multi-step business process | Employee onboarding |
3. What is the difference between Workflow Rules, Process Builder, and Flow?
Workflow Rules
Oldest automation tool.
Can:
- Update fields
- Create tasks
- Send emails
- Send outbound messages
Cannot:
- Create records
- Delete records
- Loop
- Complex logic
Process Builder
Introduced after Workflow Rules.
Can:
- Create records
- Update records
- Call Flows
- Invoke Apex
- More conditions
Limitations:
- Performance issues.
- Difficult to maintain.
- No new feature development.
Flow
Modern automation platform.
Supports:
- Complex business logic
- Loops
- Decisions
- Screens
- Apex
- Integrations
- Record creation
- Record deletion
- Scheduled automation
- Platform Events
Comparison
| Feature | Workflow | Process Builder | Flow |
|---|---|---|---|
| Field Updates | ✅ | ✅ | ✅ |
| Create Records | ❌ | ✅ | ✅ |
| Delete Records | ❌ | ❌ | ✅ |
| Loops | ❌ | ❌ | ✅ |
| Screens | ❌ | ❌ | ✅ |
| API Calls | ❌ | Limited | ✅ |
| Apex Actions | ❌ | ✅ | ✅ |
| Future Support | ❌ | ❌ | ✅ |
Interview Tip
Salesforce recommends migrating Workflow Rules and Process Builder automations to Flow. New automation should be built using Flow whenever possible.
4. What are Approval Processes?
Answer
An Approval Process automates the approval of records based on predefined business rules.
It routes records to one or more approvers before certain actions are completed.
Example
Expense Claim
- Amount < ₹10,000 → Auto-approved.
- ₹10,000–₹50,000 → Manager approval.
- ₹50,000 → Director approval.
Approval Process Steps
- Submit for Approval.
- Entry Criteria evaluated.
- Record locked.
- Approval request sent.
- Approver approves or rejects.
- Final Approval or Final Rejection actions executed.
Approval Actions
- Field Updates
- Email Alerts
- Tasks
- Outbound Messages
- Unlock Record
- Flow/Apex actions (depending on configuration)
Interview Tip
Approval Processes are ideal when records require human approval, whereas Flow is best for fully automated processes.
5. What are Assignment Rules?
Answer
Assignment Rules automatically assign Leads or Cases to the correct user or queue based on predefined criteria.
Supported Objects
- Lead
- Case
Example
Lead Country = India
→ Assign to India Sales Queue.
Lead Country = USA
→ Assign to USA Sales Queue.
Benefits
- Automatic routing.
- Faster response.
- Balanced workload.
- Reduced manual work.
Interview Tip
Assignment Rules work only for Lead and Case objects.
6. What are Auto-Response Rules?
Answer
Auto-Response Rules automatically send email acknowledgements when a Lead or Case is created.
Example
A customer submits a support case.
Salesforce immediately sends:
“Thank you for contacting us. Your Case Number is 00012345. Our team will contact you shortly.”
Supported Objects
- Lead
- Case
Benefits
- Immediate customer acknowledgement.
- Better customer experience.
- Reduced manual effort.
Interview Tip
Auto-Response Rules send emails only. They do not assign records or update fields.
7. What are Escalation Rules?
Answer
Escalation Rules automatically escalate unresolved Cases after a specified amount of time.
Example
Priority = High
If not closed within 4 hours:
- Reassign to Senior Support.
- Notify the Support Manager.
- Increase priority.
Benefits
- Ensures SLA compliance.
- Improves customer satisfaction.
- Prevents cases from being forgotten.
Interview Tip
Escalation Rules apply only to Cases.
8. Explain the Salesforce Order of Execution.
Answer
The Order of Execution is the sequence of events Salesforce follows when a record is saved.
Understanding this sequence is essential for troubleshooting automation and avoiding unexpected behavior.
Typical Order of Execution
- Load existing record (if updating).
- Apply system validations.
- Execute Before-Save Record-Triggered Flows.
- Execute Before Triggers.
- Run custom validation rules.
- Save record (not yet committed).
- Execute After Triggers.
- Execute After-Save Record-Triggered Flows.
- Execute Assignment Rules.
- Execute Auto-Response Rules.
- Execute Workflow Rules.
- Re-evaluate Workflow field updates (if any).
- Execute Processes (legacy).
- Execute Escalation Rules.
- Execute Roll-Up Summary calculations.
- Evaluate Sharing Rules.
- Commit the transaction.
- Execute post-commit logic (emails, async Apex, Platform Events, etc.).
Simplified Memory Trick
System Validation
↓
Before Flow
↓
Before Trigger
↓
Validation Rules
↓
Save
↓
After Trigger
↓
After Flow
↓
Assignment
↓
Auto Response
↓
Workflow
↓
Process Builder
↓
Escalation
↓
Commit
Interview Tip
Salesforce recommends using Before-Save Flows instead of Before Triggers for simple field updates because they are more efficient and avoid extra DML operations.
9. What is a Roll-Up Summary Field?
Answer
A Roll-Up Summary Field calculates values from related child records and displays the result on the parent record.
It is available only when the child object has a Master-Detail relationship with the parent.
Supported Operations
- COUNT
- SUM
- MIN
- MAX
Example
Order
Order Items:
- ₹500
- ₹700
- ₹800
Roll-Up Summary:
Total Amount = ₹2,000
Example 2
Account
Opportunities:
- Opportunity A
- Opportunity B
- Opportunity C
Roll-Up Summary:
Number of Opportunities = 3
Requirements
- Master-Detail relationship.
- Parent object contains the Roll-Up Summary Field.
- Optional filter criteria.
Interview Tip
Roll-Up Summary Fields do not work with Lookup relationships. For Lookup relationships, use Flow, Apex, or Declarative Lookup Rollup Summaries (DLRS).
10. What are Cross-Object Formula Fields?
Answer
A Cross-Object Formula Field retrieves and displays data from a related parent object without storing duplicate data.
It allows you to reference fields from related records using relationship paths.
Example
Objects:
- Account
- Contact
On the Contact object, create a Formula Field:
Account.Industry
This displays the Account’s Industry directly on the Contact record.
Another Example
Opportunity
Need to display the Account Owner’s Name:
Account.Owner.Name
No data is copied; the value is calculated dynamically.
Benefits
- Avoids duplicate data.
- Automatically reflects changes.
- Reduces maintenance.
- No Apex required.
Limitations
- Primarily traverses parent relationships (you cannot aggregate child records).
- Subject to relationship traversal limits in formulas.
Interview Tip
A Cross-Object Formula retrieves data from related parent records, while a Roll-Up Summary aggregates data from child records. They solve different problems.
Quick Interview Summary
| Question | One-line Answer |
|---|---|
| What is Salesforce Flow? | Salesforce’s primary low-code automation tool for building business processes. |
| Types of Flows | Record-Triggered, Screen, Scheduled, Platform Event, Autolaunched, and Flow Orchestration. |
| Workflow vs Process Builder vs Flow | Workflow and Process Builder are legacy tools; Flow is the modern, recommended automation platform. |
| Approval Process | Automates record approvals based on business rules and human approvers. |
| Assignment Rules | Automatically assign Leads or Cases to users or queues. |
| Auto-Response Rules | Automatically send acknowledgment emails for Leads or Cases. |
| Escalation Rules | Automatically escalate unresolved Cases after defined time limits. |
| Order of Execution | The sequence Salesforce follows when saving a record and executing automation. |
| Roll-Up Summary Field | Aggregates child record values (COUNT, SUM, MIN, MAX) on a parent via a Master-Detail relationship. |
| Cross-Object Formula Field | Dynamically displays fields from related parent records without duplicating data. |
Apex & SOQL
1. What is Apex?
Answer
Apex is Salesforce’s strongly typed, object-oriented programming language that developers use to implement custom business logic on the Salesforce Platform.
It has a syntax similar to Java but is designed specifically to work with Salesforce data and its multitenant architecture.
Apex runs on Salesforce servers and can execute before, during, or after database operations.
Why is Apex Used?
Apex is used when Salesforce’s declarative tools (such as Flow, Validation Rules, or Approval Processes) cannot meet complex business requirements.
Common use cases include:
- Writing Triggers
- Creating REST and SOAP APIs
- Calling external systems
- Batch processing large amounts of data
- Scheduled jobs
- Queueable and Future asynchronous processing
- Custom business logic
- Complex calculations
Features of Apex
- Object-oriented programming
- Strongly typed language
- Supports classes and interfaces
- Exception handling
- Database integration
- Built-in security
- Multitenant-aware
- Supports synchronous and asynchronous execution
Simple Apex Example
public class HelloWorld {
public static void sayHello() {
System.debug('Hello Salesforce');
}
}
Real-World Example
Suppose whenever an Opportunity is marked Closed Won, you want to:
- Create a Contract
- Create an Order
- Notify Finance
- Send data to SAP
This complex automation can be implemented using Apex.
Advantages
- Supports complex business logic
- Direct access to Salesforce objects
- Can expose REST APIs
- Supports integrations
- Highly scalable
Interview Tip
Use Flow whenever possible. Use Apex only when declarative tools cannot satisfy the business requirement.
2. What is the difference between Apex and Java?
Although Apex syntax resembles Java, there are important differences.
| Feature | Apex | Java |
|---|---|---|
| Purpose | Salesforce development | General-purpose programming |
| Runs On | Salesforce Platform | JVM (Java Virtual Machine) |
| Database Access | Built-in SOQL/SOSL | Uses JDBC/Hibernate |
| Multitenancy | Yes | No |
| Governor Limits | Yes | No |
| Triggers | Yes | No |
| UI Development | LWC, Visualforce | Swing, JavaFX, Web Frameworks |
| Deployment | Metadata Deployment | JAR/WAR deployment |
| Security | Built into platform | Developer manages security |
Example
Java
Connection con = DriverManager.getConnection(...);
Apex
List<Account> accounts =
[
SELECT Id, Name
FROM Account
];
No JDBC connection is required in Apex because Salesforce manages the database.
Similarities
- Object-oriented
- Classes
- Interfaces
- Inheritance
- Polymorphism
- Exception handling
Interview Tip
Apex is often described as Java for the Salesforce Platform, but it includes Salesforce-specific features such as SOQL, DML, Triggers, and Governor Limits.
3. What is a Trigger?
Answer
A Trigger is Apex code that executes automatically when a record is inserted, updated, deleted, or undeleted.
Triggers help automate business processes at the database level.
Trigger Events
- Before Insert
- Before Update
- Before Delete
- After Insert
- After Update
- After Delete
- After Undelete
Syntax
trigger AccountTrigger on Account (before insert) {
for(Account acc : Trigger.new){
acc.Rating='Hot';
}
}
Before Trigger
Used when updating fields on the same record before it is saved.
Example:
Automatically set Rating = “Hot”.
After Trigger
Used when:
- Creating related records
- Sending data externally
- Working with record IDs
- Updating related objects
Real-World Example
When a new Account is created:
Automatically create:
- Default Contact
- Welcome Task
- Customer Folder
Interview Tip
Choose:
- Before Trigger → Update the same record efficiently.
- After Trigger → Work with related records or perform actions that require the record to exist in the database.
4. What are Trigger Context Variables?
Answer
Trigger Context Variables provide information about the current trigger execution.
Common Context Variables
Trigger.new
Contains the new versions of records.
Available in:
- Insert
- Update
- Undelete
for(Account acc : Trigger.new){
}
Trigger.old
Contains the old versions of records.
Available in:
- Update
- Delete
Trigger.newMap
Map of new records.
Map<Id,Account>
Trigger.oldMap
Map of old records.
Trigger.isInsert
Returns true during an Insert event.
Trigger.isUpdate
Returns true during an Update event.
Trigger.isDelete
Returns true during a Delete event.
Trigger.isBefore
Returns true for Before Triggers.
Trigger.isAfter
Returns true for After Triggers.
Trigger.isExecuting
Returns true if running inside a Trigger.
Trigger.size
Returns the number of records in the current trigger execution.
Example
if(Trigger.isInsert){
System.debug('Insert Trigger');
}
Interview Tip
Trigger.new is writable only in Before Insert and Before Update triggers. In After triggers, records in Trigger.new are read-only.
5. What are Governor Limits?
Answer
Governor Limits are limits enforced by Salesforce to ensure that no single transaction consumes excessive shared resources in the multitenant environment.
Because many organizations share the same infrastructure, these limits maintain fairness and platform stability.
Common Governor Limits (Synchronous Apex)
| Limit | Value |
|---|---|
| SOQL Queries | 100 |
| DML Statements | 150 |
| Records Retrieved by SOQL | 50,000 |
| Heap Size | 6 MB |
| CPU Time | 10 Seconds |
| Callouts | 100 |
| Future Calls | 50 |
(Some limits differ for asynchronous Apex.)
Example
Bad Code
for(Account a : accounts){
List<Contact> con =
[SELECT Id FROM Contact];
}
This executes one SOQL query per loop iteration and can exceed the SOQL query limit.
Good Code
List<Contact> contacts =
[
SELECT Id
FROM Contact
];
Query once, then process the results.
Interview Tip
Governor Limits exist because Salesforce is a multitenant platform, ensuring fair resource usage for all customers.
6. What is Bulkification in Apex?
Answer
Bulkification means writing Apex code that processes multiple records efficiently in a single execution while staying within Governor Limits.
Since Triggers can receive up to 200 records in one transaction, code must handle collections rather than single records.
Bad Practice
for(Account acc : Trigger.new){
insert new Contact();
}
This performs one DML statement per record.
Good Practice
List<Contact> contacts =
new List<Contact>();
for(Account acc : Trigger.new){
contacts.add(new Contact(
LastName='Demo',
AccountId=acc.Id));
}
insert contacts;
Only one DML statement is executed.
Bulkification Rules
- Never write SOQL inside loops.
- Never write DML inside loops.
- Use Lists, Maps, and Sets.
- Process records in collections.
Interview Tip
Bulkification is one of the most frequently asked Apex interview topics because it directly impacts Governor Limits and application performance.
7. What is SOQL?
Answer
SOQL (Salesforce Object Query Language) is Salesforce’s query language used to retrieve records from Salesforce objects.
It is similar to SQL but is designed specifically for Salesforce data and relationships.
Syntax
SELECT Name
FROM Account
Example
List<Account> accounts =
[
SELECT Id,
Name,
Industry
FROM Account
WHERE Industry='IT'
];
Features
- Retrieve specific fields.
- Filter records.
- Sort results.
- Relationship queries.
- Aggregate functions.
Parent-to-Child Query
SELECT Name,
(
SELECT LastName
FROM Contacts
)
FROM Account
Child-to-Parent Query
SELECT Name,
Account.Name
FROM Contact
Interview Tip
SOQL retrieves data from one object at a time, although it supports traversing relationships.
8. What is the difference between SOQL and SOSL?
SOQL
Used to retrieve records from a specific object.
Example
SELECT Name
FROM Account
SOSL
Used to search text across multiple objects and multiple fields.
Example
FIND 'John'
IN ALL FIELDS
RETURNING
Account(Name),
Contact(Name)
Comparison
| SOQL | SOSL |
|---|---|
| Queries one object (with relationship support) | Searches multiple objects |
| Uses SELECT | Uses FIND |
| Best for structured data retrieval | Best for keyword search |
| Returns records from one object query | Can return records from many objects |
Real-World Example
Need all IT Accounts?
Use SOQL.
Need to search the keyword “Amazon” across Accounts, Contacts, Leads, and Cases?
Use SOSL.
Interview Tip
Use SOQL when you know which object contains the data. Use SOSL when you know the search term but not necessarily the object.
9. What are DML Statements?
Answer
DML (Data Manipulation Language) statements are used to insert, update, delete, undelete, merge, or upsert records in Salesforce.
Common DML Statements
Insert
insert accountList;
Update
update accountList;
Delete
delete accountList;
Upsert
upsert accountList;
Inserts new records or updates existing ones based on an ID or External ID.
Merge
merge master duplicate;
Combines duplicate records.
Undelete
undelete deletedAccounts;
Restores records from the Recycle Bin.
Interview Tip
A DML statement counts toward the Governor Limit of 150 DML statements per transaction, regardless of how many records are included in a single statement.
10. What is the difference between Database methods and DML statements?
Answer
Both are used to perform database operations, but they differ in error handling and transaction behavior.
DML Statement
insert accounts;
If one record fails, the entire transaction fails and all records are rolled back.
Database Method
Database.insert(accounts,false);
The second parameter (false) enables partial success.
Valid records are inserted.
Invalid records fail, and Salesforce returns detailed results.
SaveResult Example
Database.SaveResult[] results =
Database.insert(accounts,false);
for(Database.SaveResult sr : results){
if(!sr.isSuccess()){
System.debug(sr.getErrors());
}
}
Comparison
| DML Statements | Database Methods |
|---|---|
| Throws an exception on failure | Returns SaveResult/DeleteResult, etc. |
| Entire transaction rolls back on error | Supports partial success with allOrNone = false |
| Simpler syntax | More control over error handling |
No allOrNone option | allOrNone can be true or false |
Real-World Example
Suppose you insert 100 Accounts.
- 95 are valid.
- 5 have validation rule errors.
Using:
insert accounts;
→ All 100 fail.
Using:
Database.insert(accounts,false);
→ 95 succeed, 5 fail, and you can inspect the errors.
Interview Tip
Use Database methods when you want partial success and need to process individual record failures. Use DML statements when all records must succeed or fail together.
Quick Interview Summary
| Question | One-line Answer |
|---|---|
| What is Apex? | Salesforce’s object-oriented programming language for implementing custom business logic. |
| Apex vs Java | Apex is Java-like but built for Salesforce with SOQL, DML, Triggers, Governor Limits, and multitenancy. |
| What is a Trigger? | Apex code that automatically executes on record events such as insert, update, delete, and undelete. |
| Trigger Context Variables | Built-in variables (e.g., Trigger.new, Trigger.old, Trigger.isInsert) that describe the trigger context. |
| Governor Limits | Resource limits that ensure fair usage of the shared Salesforce platform. |
| Bulkification | Writing Apex to process collections efficiently and avoid SOQL/DML inside loops. |
| SOQL | Salesforce Object Query Language used to retrieve data from Salesforce objects. |
| SOQL vs SOSL | SOQL queries known objects; SOSL performs text searches across multiple objects. |
| DML Statements | Commands such as insert, update, delete, upsert, merge, and undelete that modify Salesforce data. |
| Database Methods vs DML | Database methods support partial success and detailed error handling; DML statements are simpler but fail the entire transaction on error. |
Lightning Web Components (LWC)
1. What is Lightning Web Components (LWC)?
Answer
Lightning Web Components (LWC) is Salesforce’s modern UI framework used to build fast, reusable, and lightweight web applications on the Salesforce Platform.
LWC is built using standard web technologies:
- HTML
- JavaScript (ES6+)
- CSS
- Web Components
- Shadow DOM
Unlike Aura Components, LWC follows modern web standards, making it faster, easier to learn, and more performant.
Salesforce recommends using LWC for all new UI development.
Why is LWC Used?
LWC is used to build:
- Record Pages
- Custom Forms
- Dashboards
- Reusable Components
- Quick Actions
- Screen Flows
- Experience Cloud Components
- Utility Bar Components
Architecture
HTML
↓
JavaScript
↓
CSS
↓
Salesforce Platform
Features
- High performance
- Reusable components
- Modern JavaScript
- Shadow DOM for encapsulation
- Reactive programming
- Apex integration
- Lightning Data Service (LDS)
- Event-driven communication
Real-World Example
Imagine a Bank Loan Application.
The LWC can:
- Display loan details.
- Calculate EMI instantly.
- Validate user input.
- Save the application.
- Show approval status.
- Upload documents.
Everything happens within a responsive Lightning interface.
Advantages
- Faster than Aura Components.
- Better performance.
- Standard web development skills.
- Easier debugging.
- Better browser support.
- Lightweight framework.
LWC vs Aura
| LWC | Aura |
|---|---|
| Modern framework | Older framework |
| Faster | Slower |
| Uses standard JavaScript | Uses Aura-specific syntax |
| Better performance | More overhead |
| Recommended by Salesforce | Legacy framework |
Interview Tip
Salesforce recommends LWC over Aura for all new component development because it is faster, standards-based, and actively enhanced.
2. What are the files required to create an LWC?
Answer
Every Lightning Web Component consists of a bundle (folder) that contains multiple files with the same name.
Minimum required files:
myComponent
│
├── myComponent.html
├── myComponent.js
├── myComponent.js-meta.xml
Optional:
myComponent.css
1. HTML File
Defines the user interface.
Example:
<template>
<lightning-card title="Welcome">
Hello Salesforce
</lightning-card>
</template>
2. JavaScript File
Contains the component logic.
Example:
import { LightningElement } from 'lwc';
export default class MyComponent extends LightningElement {}
3. XML Configuration File
Determines where the component can be used.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle
xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>64.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
4. CSS File (Optional)
Defines the component styling.
Example:
.heading{
color:blue;
}
Summary
| File | Purpose |
|---|---|
| HTML | UI |
| JS | Business Logic |
| CSS | Styling |
| XML | Component Configuration |
Interview Tip
Only HTML, JavaScript, and .js-meta.xml are required. The CSS file is optional.
3. Explain @api, @track, and @wire decorators.
Decorators add special functionality to properties and methods in LWC.
@api
Purpose
Makes a property or method public so it can be accessed by a parent component or the Lightning App Builder.
Example
Child Component
import { LightningElement, api } from 'lwc';
export default class Child extends LightningElement {
@api recordId;
}
Parent Component
<c-child record-id={recordId}></c-child>
Use Cases
- Receive values from a parent component.
- Expose methods to parent components.
- Access
recordIdon record pages.
@track
Purpose
Makes object and array property changes reactive.
In modern LWC, primitive properties (String, Number, Boolean) are reactive by default. @track is mainly needed when you want changes within nested objects or arrays to trigger UI updates.
Example
import { track } from 'lwc';
@track employee = {
name:'John',
salary:5000
};
Without @track (for nested mutations), changing employee.name may not update the UI as expected. Alternatively, you can assign a new object:
this.employee = { ...this.employee, name: 'Mike' };
@wire
Purpose
Connects a component to Salesforce data or an Apex method reactively.
Example
import { wire } from 'lwc';
import getAccounts from
'@salesforce/apex/AccountController.getAccounts';
@wire(getAccounts)
accounts;
Salesforce automatically calls the Apex method and refreshes the data when reactive parameters change.
Decorator Summary
| Decorator | Purpose |
|---|---|
@api | Public property/method accessible by parent components or App Builder |
@track | Makes changes within objects/arrays reactive (when mutating nested values) |
@wire | Retrieves Salesforce data or Apex data reactively |
Interview Tip
- Use
@apifor communication from parent to child. - Use
@wirefor reactive data retrieval. - Use
@trackonly when needed for nested object/array mutations; many cases today can be handled by assigning a new object or array.
4. What is Data Binding in LWC?
Answer
Data Binding is the process of connecting JavaScript data with the HTML template so the UI automatically reflects data changes.
LWC primarily supports one-way data binding from JavaScript to the template. User input is typically handled through events.
Example
JavaScript
name='Ashutosh';
HTML
<template>
{ name }
</template>
Output
Ashutosh
User Input Example
HTML
<lightning-input
label="Name"
onchange={handleChange}>
</lightning-input>
JavaScript
handleChange(event){
this.name=event.target.value;
}
When this.name changes, the UI updates automatically.
Benefits
- Automatic UI updates.
- Less code.
- Better maintainability.
- Reactive framework.
Interview Tip
LWC uses reactive rendering. When tracked or reactive properties change, the template re-renders automatically.
5. Explain the LWC Component Lifecycle.
Answer
The LWC lifecycle defines the sequence of events that occur from component creation to removal from the page.
Lifecycle Flow
Constructor
↓
connectedCallback()
↓
render()
↓
renderedCallback()
↓
disconnectedCallback()
↓
errorCallback()
1. Constructor
Called when the component instance is created.
Used for:
- Basic initialization.
Do not access DOM elements here.
2. connectedCallback()
Runs when the component is inserted into the DOM.
Used for:
- Calling imperative Apex.
- Initializing variables.
- Registering listeners.
Example
connectedCallback(){
console.log('Connected');
}
3. render()
Determines which template to render (rarely overridden).
4. renderedCallback()
Runs after the component has been rendered.
Used for:
- Accessing DOM.
- Initializing third-party libraries.
- Post-render logic.
Avoid updating reactive properties here without safeguards, as it can cause rendering loops.
5. disconnectedCallback()
Runs when the component is removed from the DOM.
Used for:
- Cleaning timers.
- Removing event listeners.
- Releasing resources.
6. errorCallback()
Handles errors from child components.
Interview Tip
The two lifecycle hooks used most often are:
connectedCallback()renderedCallback()
6. How do you call an Apex method from LWC?
Answer
There are two ways to call Apex from an LWC:
- Using
@wire - Imperative Apex Call
Method 1: @wire
Best for:
- Read operations.
- Reactive data.
Apex
public with sharing class AccountController {
@AuraEnabled(cacheable=true)
public static List<Account> getAccounts(){
return [
SELECT Id,Name
FROM Account
];
}
}
LWC
import getAccounts
from '@salesforce/apex/AccountController.getAccounts';
import { wire } from 'lwc';
@wire(getAccounts)
accounts;
Advantages
- Automatic refresh when reactive parameters change.
- Client-side caching with
cacheable=true. - Less code.
Method 2: Imperative Apex
Used when:
- Button click.
- Create/Update/Delete operations.
- Conditional execution.
- Passing dynamic parameters.
- Calling non-cacheable methods.
Apex
@AuraEnabled
public static void createAccount(){
}
JavaScript
import createAccount
from '@salesforce/apex/AccountController.createAccount';
createAccount()
.then(result=>{
})
.catch(error=>{
});
Comparison
@wire | Imperative Apex |
|---|---|
| Reactive | Called manually |
| Read operations | Read and write operations |
Requires cacheable=true for Apex methods | No cacheable=true required |
| Automatic invocation | Invoked on demand |
Real-World Example
@wire
Display a list of Accounts whenever the component loads.
Imperative Apex
When the user clicks Save, create an Account and show a success message.
Interview Tip
Use @wire for retrieving data reactively. Use Imperative Apex for user-driven actions (such as button clicks) and any operation that modifies data.
Quick Interview Summary
| Question | One-line Answer |
|---|---|
| What is LWC? | Salesforce’s modern, standards-based framework for building fast and reusable UI components. |
| Required LWC Files | .html, .js, .js-meta.xml (required), .css (optional). |
@api | Exposes public properties or methods to parent components and App Builder. |
@track | Makes nested object/array mutations reactive when needed. |
@wire | Reactively retrieves Salesforce data or Apex results. |
| Data Binding | Connects JavaScript properties with the HTML template so the UI updates automatically. |
| LWC Lifecycle | constructor → connectedCallback → render → renderedCallback → disconnectedCallback → errorCallback. |
| Calling Apex from LWC | Use @wire for reactive read operations and imperative calls for user actions or data modifications. |
Scenario-Based & Deployment
1. How would you automate email notifications when an Opportunity is Closed Won?
Answer
There are multiple ways to automate this requirement in Salesforce. However, Salesforce recommends using Record-Triggered Flow because Workflow Rules and Process Builder are being retired.
Requirement
Whenever an Opportunity’s Stage changes to Closed Won:
- Send an email to the Sales Manager.
- Notify the customer (optional).
- Create a follow-up Task (optional).
- Create a Contract (optional).
Solution Using Record-Triggered Flow (Recommended)
Step 1: Create a Record-Triggered Flow
- Go to Setup → Flows
- Click New Flow
- Select Record-Triggered Flow
Step 2: Select Object
Object:
Opportunity
Step 3: Configure Trigger
Run Flow:
When a record is updated
Condition:
StageName = Closed Won
Optimize For:
Actions and Related Records
(After Save Flow)
Step 4: Add Decision (Optional)
To avoid duplicate emails:
IsChanged(StageName)
AND
StageName = Closed Won
Step 5: Add Email Action
Use:
Send Email
Recipient:
- Opportunity Owner
- Sales Manager
- Customer
Subject:
Opportunity Closed Successfully
Body:
Congratulations!
Opportunity {!Opportunity.Name}
has been marked as Closed Won.
Amount:
{!Opportunity.Amount}
Step 6: Activate Flow
Done.
Alternative Solutions
| Method | Recommended? |
|---|---|
| Workflow Rule | ❌ Legacy |
| Process Builder | ❌ Legacy |
| Record Triggered Flow | ✅ Best |
| Apex Trigger | ✅ For complex logic |
Real-Time Scenario
A company closes around 500 Opportunities every day.
Whenever an Opportunity is Closed Won:
- Finance should receive an email.
- Sales Manager should receive a notification.
- Contract should be created automatically.
- Welcome Email should be sent.
One After-Save Flow can automate all these steps.
Interview Tip
For most business requirements, start with Flow. Use Apex only if Flow cannot satisfy the requirement or if the logic is exceptionally complex.
2. A user cannot access a record. How would you troubleshoot the issue?
Answer
Salesforce record access depends on multiple security layers. I would troubleshoot systematically.
Step 1: Verify Object Permission
Check the user’s:
- Profile
- Permission Sets
Questions:
- Does the user have Read access?
- Does the user have Edit access?
If object permission is missing, the record cannot be accessed regardless of sharing.
Step 2: Check Field-Level Security (FLS)
Sometimes users can open the record but cannot see certain fields.
Verify:
- Field Visibility
- Read Only settings
Step 3: Check Organization-Wide Defaults (OWD)
Go to:
Sharing Settings
Check:
Account
Private?
If OWD is Private, users only see records they own unless additional sharing is configured.
Step 4: Check Record Ownership
Questions:
Who owns the record?
Is the current user the owner?
Step 5: Check Role Hierarchy
If OWD is Private:
Can the user’s role access records owned by users below them?
Example
Manager
↓
Sales Rep
Manager can see the Sales Rep’s records.
Step 6: Check Sharing Rules
Verify whether a Sharing Rule should grant access based on:
- Owner
- Criteria
Step 7: Check Manual Sharing
Someone may have manually shared the record.
Step 8: Check Teams
For Opportunity:
Opportunity Team
For Account:
Account Team
These can provide additional record access.
Step 9: Check Apex Sharing
Developers may have implemented custom Apex Sharing.
Step 10: Check Restriction Rules (if applicable)
Restriction Rules can further limit which records users can see, even when sharing grants access.
Troubleshooting Flow
Profile
↓
Permission Set
↓
OWD
↓
Role Hierarchy
↓
Sharing Rules
↓
Manual Sharing
↓
Teams
↓
Apex Sharing
↓
Restriction Rules
Interview Tip
Always troubleshoot from the most fundamental security layer to the most specific. A structured approach demonstrates strong Salesforce administration skills.
3. Explain the deployment process from Sandbox to Production.
Answer
Deployment is the process of moving configuration and code from one Salesforce environment to another.
Typically:
Developer Sandbox
↓
Developer Pro
↓
Partial Copy
↓
Full Sandbox
↓
Production
Typical Deployment Steps
Step 1: Development
Develop new features in a Sandbox.
Examples:
- Apex Classes
- LWC
- Flows
- Validation Rules
- Objects
- Fields
Step 2: Testing
Perform:
- Unit Testing
- Functional Testing
- Integration Testing
- UAT (User Acceptance Testing)
Step 3: Deployment
Common deployment methods:
- Change Sets
- Salesforce CLI (SFDX)
- DevOps Center
- Metadata API
- Third-party tools (Gearset, Copado, AutoRABIT)
Change Set Process
Outbound Change Set
Created in Sandbox.
Include:
- Apex
- LWC
- Flow
- Objects
- Fields
Upload to Production.
Inbound Change Set
Open in Production.
Validate.
Deploy.
Apex Requirement
Production deployment requires:
75%
Code Coverage
This is the minimum org-wide code coverage requirement, and all tests required by the deployment must pass.
Best Practices
- Deploy in lower environments first.
- Validate before deployment.
- Run all required tests.
- Take a backup.
- Use Version Control (Git).
- Prefer CI/CD for enterprise projects.
Real-Time Enterprise Process
Developer
↓
GitHub
↓
CI/CD
↓
UAT Sandbox
↓
Production
Interview Tip
For enterprise projects, mention Git, Salesforce CLI, and CI/CD pipelines. While Change Sets are useful for learning and small projects, larger organizations typically use source-driven development and automated deployments.
4. Describe a Salesforce project or Trailhead challenge you worked on and what you learned.
Sample Answer (Fresher)
During my Salesforce learning journey, I completed several Trailhead modules and Superbadges that helped me understand real-world business scenarios.
One of the most valuable challenges I completed was a Sales Cloud automation project.
Requirement
The business wanted to automate the sales process.
Whenever an Opportunity reached the Closed Won stage:
- Notify the Sales Manager.
- Create a follow-up Task.
- Update the Account status.
- Send a confirmation email.
Solution
I built the solution using:
- Record-Triggered Flow
- Validation Rules
- Email Alerts
- Custom Fields
- Reports
- Dashboards
Challenges
Initially, I struggled with:
- Understanding the Order of Execution.
- Designing efficient Flow logic.
- Avoiding duplicate automation.
- Testing different scenarios.
I resolved these issues by using Decision elements, proper entry conditions, and thorough testing.
What I Learned
Through this project, I gained hands-on experience with:
- Flow Automation
- Security (Profiles, Roles, Sharing)
- Reports & Dashboards
- Record-Triggered Flows
- Validation Rules
- Debugging
- Testing
- Deployment basics
Most importantly, I learned that there are often multiple ways to solve a requirement in Salesforce, and it’s important to choose the simplest, most maintainable solution.
Alternative Answer (Developer)
In one of my projects, I built a custom Lightning Web Component that displayed Account and Opportunity information. The component called Apex imperatively to retrieve data, allowed users to update records, and refreshed the UI after changes. I also wrote Apex test classes to maintain deployment-ready code coverage, handled exceptions gracefully, and optimized SOQL queries to avoid Governor Limits. This project strengthened my understanding of LWC, Apex, SOQL, bulkification, and secure coding practices.
Interview Tips
When answering project-based questions:
- Explain the business requirement first.
- Describe your solution.
- Mention the Salesforce features you used.
- Explain any challenges and how you solved them.
- Conclude with what you learned.
A simple structure to remember is:
Requirement → Solution → Challenges → Learning
Quick Interview Summary
| Question | One-line Answer |
|---|---|
| Automate email when Opportunity is Closed Won | Use an After-Save Record-Triggered Flow with a Send Email action (Apex if the logic is highly complex). |
| User cannot access a record | Check Object Permissions → FLS → OWD → Record Owner → Role Hierarchy → Sharing Rules → Manual Sharing → Teams → Apex Sharing → Restriction Rules. |
| Sandbox to Production deployment | Develop in Sandbox, test thoroughly, deploy using Change Sets, Salesforce CLI, DevOps Center, or CI/CD, ensuring required tests pass and the org meets the 75% Apex code coverage requirement. |
| Describe a Salesforce project | Explain the business requirement, solution, technologies used, challenges faced, and lessons learned using a real project or Trailhead challenge. |
Best Salesforce Interview Preparation Resources (2026)
Trusted by 2000+ learners preparing for Salesforce interviews
🔗 1–4 Years Experience (Juniors & Freshers)
👉 https://trailheadtitanshub.com/100-real-salesforce-scenario-based-interview-questions-2025-edition-for-1-4-years-experience/
🔗 4–8 Years Experience (Mid / Senior Roles)
👉 https://trailheadtitanshub.com/100-real-time-salesforce-scenario-based-interview-questions-2025-edition-for-4-8-years-experience/
🔗 Mixed Roles (Admin + Apex + SOQL + LWC + Integration)
👉 https://trailheadtitanshub.com/100-real-time-salesforce-interview-questions-scenarios-2025-edition-admin-apex-soql-lwc-vf-integration/
🚀 Mega Interview Pack — 2000+ Recruiter Questions
👉 https://trailheadtitanshub.com/salesforce-interview-mega-pack-600-real-questions-from-recruiter-calls-with-my-best-performing-answers/
💼 1000+ Real Dev/Admin Interview Q&A (Infosys, EY, Dell, TCS)
👉 https://trailheadtitanshub.com/500-real-interview-questions-answers-from-top-tech-companies-ey-infosys-tcs-dell-salesforce-more/
📊 Salesforce Project Guide — Sales Cloud
👉 https://trailheadtitanshub.com/salesforce-project-sales-cloud/
🔥 34-Day Salesforce Interview Battle Plan
👉 https://trailheadtitanshub.com/crack-the-interview-real-questions-real-struggles-my-students-34-day-journey/




