Skip to content
← Writing

Salesforce Developer Interview Questions 2026: 15 Answers

15 Salesforce developer interview questions for 2026 with answers: Apex, triggers, async jobs and security, with code and official doc links.

21 Oct 2026·8 min read·Salesforce AI

Chitiz Agarwal interviewing a developer candidate across a desk, discussing Salesforce developer interview questions

A trigger with a SOQL query inside a for loop passes every test in your sandbox and then fails the first time someone loads 200 records. That one mistake is behind a large share of the Salesforce developer interview questions you'll be asked in 2026.

If you're a fresher, a 2-5 year developer or a senior engineer moving towards Agentforce, this page gives you the questions, the answers and the reasoning behind them. I've kept every technical fact tied to Salesforce's own documentation. For more guides like this, see my Salesforce page.

Key takeaways

  • Salesforce developer interviews reward reasoning about bulk data, governor limits and security, not recall of definitions.
  • Agentforce questions are the same questions in new clothes: limits, access, guardrails, testing and when not to use an agent.
  • Learn each answer as a chain of "because", since follow-up questions are where memorised answers collapse.
  • Practise with a real org: break a trigger with 200 records, then fix it.

How are Salesforce developer interviews really scored?

Interviewers score how you think about what breaks, not how many definitions you can recite.

My central argument is simple: a question bank is a revision aid, never a strategy. Questions leak, and interviewers know it. So they ask the follow-up. "Why does that fail?" "What if it's 5,000 records?" "Who can see that field?"

I've deliberately not linked to any of the question banks online. Many are written to help candidates pass interviews, and the answers inside them often stop at the definition. The questions below are grouped by level. Read the "because" in each answer, not just the first line.

Salesforce developer interview questions for freshers

A fresher is expected to explain the platform's core ideas clearly and to know why limits exist.

1. What is Apex?

Apex is a strongly typed, object-oriented language that runs on Salesforce servers, with Java-like syntax. It's used for triggers, controllers, web services and batch jobs. See What is Apex? in the Apex Developer Guide.

2. What are governor limits and why do they exist?

Salesforce is multitenant, so many customers share the same resources. Governor limits stop one customer's code from consuming them. Know the headline numbers for a synchronous transaction: 100 SOQL queries, 150 DML statements, 50,000 rows returned by SOQL and 10 seconds of CPU time. Asynchronous transactions get higher limits for some of these (200 queries, 60 seconds of CPU). The full table is in Execution Governors and Limits.

3. What is the difference between SOQL and SOSL?

SOQL queries one object, plus related objects through relationships, and returns records. SOSL searches text across multiple objects and fields at once and returns a list of lists. Use SOQL when you know the object, SOSL when you're searching. Reference: SOQL and SOSL.

4. What is the difference between a lookup and a master-detail relationship?

In a master-detail relationship, the parent is required, the child inherits the parent's sharing and ownership, deleting the parent deletes the children, and you can build roll-up summary fields. A lookup is looser: the parent is optional and the records are independent. The Trailhead module Data Modeling covers both.

5. What is the difference between before and after triggers?

Use a before trigger to validate or change fields on the records being saved, because you can edit Trigger.new without a DML statement. Use an after trigger when you need the record Id or need to touch related records. In after triggers the records in Trigger.new are read-only. See Triggers and context variables.

6. What does "bulkify" mean? Show me.

It means your code handles up to 200 records per trigger invocation with a fixed number of queries and DML statements. Data loads arrive in chunks of 200, and platform event triggers can receive up to 2,000 events at once, so bulk triggers aren't optional.

Wrong:

for (Contact c : Trigger.new) {
    Account a = [SELECT Id, Industry FROM Account WHERE Id = :c.AccountId]; // 1 query per record
}

Right:

Set<Id> accountIds = new Set<Id>();
for (Contact c : Trigger.new) {
    if (c.AccountId != null) accountIds.add(c.AccountId);
}
Map<Id, Account> accounts = new Map<Id, Account>(
    [SELECT Id, Industry FROM Account WHERE Id IN :accountIds]
);
for (Contact c : Trigger.new) {
    Account a = accounts.get(c.AccountId);
    if (a != null && a.Industry == 'Banking') c.Description = 'Banking contact';
}

One query, however many contacts arrive.

My take: If you can only prepare one thing, prepare this. Write the bad version, load 200 records, watch it fail, then fix it. You'll never forget it.

7. What is the difference between insert and Database.insert?

The insert statement throws an exception and rolls back the whole operation if any record fails. Database.insert(records, false) allows partial success and returns a result per record, so you can log the failures. Pick based on whether one bad record should block the rest.

8. How do you write a test class, and what coverage do you need?

Annotate with @isTest, create your own test data, run the logic between Test.startTest() and Test.stopTest(), and use assertions to check outcomes. At least 75% of your Apex must be covered, all tests must pass, and every trigger needs some coverage to deploy to production. Coverage is a gate, not a quality measure, so assert behaviour. See Testing Apex.

9. When would you use Flow instead of Apex?

Start declarative: if a Flow meets the requirement, it's cheaper to build and easier for admins to maintain. Move to Apex when logic is complex, volumes are high, you need fine control over transactions and errors, or you want unit-testable code. Flow overview: Salesforce Help.

Salesforce Apex interview questions for 2-5 years of experience

At this level interviewers hand you a scenario and watch whether you spot limits, recursion and security gaps before you're asked.

10. How do you structure triggers in a real project?

Use one trigger per object, with no logic inside it. The trigger hands Trigger.operationType and the record collections to a handler class, which calls service classes. That gives you a predictable order, easier testing and one place to switch logic off.

trigger ContactTrigger on Contact (before insert, before update, after insert, after update) {
    ContactTriggerHandler.handle(Trigger.operationType, Trigger.new, Trigger.oldMap);
}

11. How do you stop a trigger from running recursively?

A static Boolean flag is the usual first answer, and it's flawed. When more than 200 records are saved, the trigger fires in chunks within the same transaction, so a flag set on the first chunk silently skips the rest. Track processed record Ids instead. Use this in update and after-trigger contexts: in a before-insert trigger records have no Id yet, so they would all share the same null key.

public class TriggerGuard {
    private static Set<Id> processed = new Set<Id>();
    public static Boolean firstTime(Id recordId) {
        return processed.add(recordId); // true only the first time
    }
}

12. What is the order of execution?

In outline: before-save flows, before triggers, validation, save to the database (not yet committed), after triggers, then assignment and other rules, after-save flows, roll-up summaries, commit, and post-commit work such as email. Don't try to recite every step. Know the outline (my guide to the order of execution in Salesforce walks through it), then name the practical risk: a field update in an after trigger can fire triggers and flows again. The full list is in Triggers and Order of Execution.

13. Future, Queueable, Batch or Scheduled: which and why?

OptionUse whenWatch out for
Future methodSimple fire-and-forget workStatic void, primitive parameters only, no chaining
QueueableWork that needs objects as parameters or job chainingReturns a job Id you can monitor
Batch ApexLarge volumes processed in chunks (default scope 200)A query locator can cover up to 50 million records; implement Database.Stateful only if you need state across chunks
Scheduled ApexRunning at a set timeIt often just kicks off a batch

My default is Queueable for small background jobs and Batch for anything large.

14. How do you keep SOQL efficient on large objects?

Filter on indexed fields so the query is selective, query only the fields you need, and never run queries inside loops. Use a SOQL for loop when you're iterating over a large result set, because it retrieves records in chunks instead of holding them all in memory. The heap and row limits are on the limits page. An interviewer will probably follow with "what would you check if this query times out?" The answer starts with filter selectivity.

15. Apex runs in system mode. How do you enforce user permissions?

By default Apex ignores object and field permissions, and the with sharing keyword only enforces record-level sharing. To respect what the running user can do, use WITH USER_MODE in SOQL queries and AccessLevel.USER_MODE in Database methods, for example Database.insert(records, AccessLevel.USER_MODE). User mode enforces object permissions, field-level security and sharing together. In older code you'll also see WITH SECURITY_ENFORCED and Security.stripInaccessible(); know what each does, but prefer user mode in new code.

How should you prepare with these Salesforce developer interview questions?

Don't memorise the answers. For each one, build a small example in a free Developer Edition org, break it on purpose, and fix it. Interviewers can tell the difference between someone who has read about governor limits and someone who has hit one. If you can explain a real bug you caused and how you fixed it, that answer will carry more weight than any definition.

More guides are on the blog. Want to talk through a question? Get in touch.

Frequently asked questions

What are the most common Salesforce developer interview questions?

This page covers governor limits, bulkification, triggers, SOQL versus SOSL, async Apex and security. Interviewers follow each one with a "why does that fail?" question.

What Apex governor limits should I know for an interview?

For a synchronous transaction: 100 SOQL queries, 150 DML statements, 50,000 rows returned by SOQL and 10 seconds of CPU time. Asynchronous transactions get higher limits for some of these.

How much code coverage do you need to deploy Apex?

At least 75% of your Apex must be covered and all tests must pass. Coverage is a gate, not a quality measure, so assert behaviour.

How should I prepare for a Salesforce developer interview?

For each question, build a small example in a free Developer Edition org, break it on purpose and fix it. Start with a trigger that has a SOQL query inside a loop, and load 200 records.

Are Agentforce interview questions different?

They are the same questions in new clothes: limits, access, guardrails, testing and when not to use an agent.

Want to put this to work in your business?

Join one of my live sessions, or tell me what you're trying to do with AI.

Newsletter

Get the next one by email.

New writing on Salesforce AI, AI agents and the AI-Native Enterprise. Confirm by email; unsubscribe any time.

Keep reading