Top 20 Salesforce Interview Questions & Answers (With Real-Time Scenarios) — 2025 Cheat Sheet

A compact, up-to-date guide to the 20 most common Salesforce interview questions — with real-time scenarios, code examples, and interview tips for admins and developers.

Introduction

Preparing for a Salesforce Admin or Developer interview? This cheat sheet covers 20 frequently asked questions with concise explanations, practical examples, and recommended best practices. Use this as a study guide to explain not just what a feature is, but when and why you would use it in real projects.

Top Questions & Short Answers

Below are highlights from the full list — expand these into examples during interviews.

1. Workflow vs Process Builder vs Flow

Workflow: legacy automation (field updates, email alerts) and being retired. Process Builder: more capable but also deprecated. Flow: the recommended automation platform — supports before/after save logic, screen flows, subflows, and external callouts.

2. Preventing recursion in Apex triggers

Use a static Boolean or a trigger control map in a handler class to ensure logic runs only once per transaction.

public class TriggerHandler {
    private static Boolean runOnce = true;
    public static void handleTrigger(List accounts) {
        if(!runOnce) return;
        runOnce = false;
        // business logic here
    }
}

3. @wire vs Imperative Apex in LWC

  • @wire: Reactive, auto-refreshes, best for read-only data.
  • Imperative: Manual calls — use for conditional fetches, DML, and callouts.

4. Mix DML Error

Happens when setup and non-setup objects are mixed in the same transaction (e.g., User + Account). Fix by moving one DML to an async context (Queueable or @future).

5. SOQL vs SOSL

SOQL: targeted queries for a single object and specific fields. SOSL: full-text search across multiple objects and fields.

6. Async Apex Options

  • Future: simple async, no chaining.
  • Queueable: supports chaining and complex types.
  • Batch: processes large volumes (chunked).
  • Scheduled: runs at a specified time or interval.

7. Bulk DML in Triggers

  • Always bulkify: use collections (List/Map/Set).
  • Move SOQL and DML outside loops.
  • Leverage Trigger.new and Trigger.oldMap.

8. Lightning Data Service (LDS)

LDS handles CRUD, security, and FLS for record components without Apex — ideal for simple record editing or display in LWCs.

9. Can Flow Replace Apex Triggers?

For many simple updates and validations, yes. For advanced use cases with complex recursion control, heavy processing, or custom callouts, Apex remains necessary.

10. Test.startTest / Test.stopTest

Use these in Apex tests to create a fresh governor-limit context and to ensure async jobs run within test execution.

11. 15-digit vs 18-digit IDs

15-digit IDs are case-sensitive (UI). The 18-digit version is case-insensitive and safe for APIs.

12. Calling Apex from Flow

Use @InvocableMethod with List-based input/output wrapper classes to make Apex methods invocable from Flow.

13. Trigger Context Variables

Common context variables: Trigger.new, Trigger.old, Trigger.newMap, Trigger.oldMap, Trigger.isInsert, isUpdate, isBefore, isAfter.

14. @AuraEnabled Annotation

Makes Apex methods available to Aura and LWC. Use cacheable=true for read-only operations to improve performance.

15. Schedule a Batch Job at 2 AM

System.schedule('Daily Batch', '0 0 2 * * ?', new MyBatchClass());

16. Governor Limits

Salesforce enforces limits to protect the multi-tenant environment. Examples include max SOQL queries, DML statements, CPU time, and heap size. Design with bulkification and efficient queries to avoid limits.

17. Parent-Child SOQL

Parent to child example:

SELECT Name, (SELECT LastName FROM Contacts) FROM Account

Child to parent example:

SELECT Id, Account.Name FROM Contact

18. Wrapper Class

A wrapper class groups related fields/records into a single structure useful in UI lists, batch processing, or complex Flow interactions.

19. Salesforce Order of Execution (Simplified)

  • Validation rules
  • Before triggers
  • After triggers
  • Assignment rules
  • Workflow / Process / Flow
  • Commit

20. Continuous Integration (CI) in Salesforce

CI automates builds and deployments using tools like GitHub Actions, Jenkins, Bitbucket Pipelines, or Copado. CI reduces deployment risk and improves collaboration.

Key Takeaways

  • Prefer Flow for new automation but understand when Apex is required.
  • Write bulkified, test-covered Apex and avoid SOQL/DML in loops.
  • Practice explaining real-time scenarios — interviewers prefer practical examples over memorized definitions.

Why this matters

Interviewers for Admin and Developer roles expect candidates to not only recite definitions but to demonstrate practical judgment: when to use Flow vs Apex, how to design for governor limits, and how to write maintainable code. Mastering these 20 areas will help you explain trade-offs clearly and stand out in interviews.

Recommended Categories & Tags

This post is ideal for Interview Q&A, Salesforce Tips, and anyone preparing for developer/admin interviews.