Software & Engineering
Salesforce Developer mock interview
A Salesforce developer interview is mostly scenario questions. You are given a business rule, such as updating an account when its contacts change, and asked how you would build it. Interviewers judge whether your answer is bulk-safe, stays inside governor limits, considers a Flow before code, and comes with a test class that would pass a deployment.
This page’s practice link sets up a technical round for a Salesforce Developer, with questions asked one at a time and follow-ups when an answer leaves out what happens with 200 records. You answer by talking it through, the way most Salesforce rounds run. Each answer is scored from 0 to 100 for relevance, depth and clarity; the round report weighs code quality (25%), problem solving (30%), technical knowledge (25%) and communication (20%). The round also includes one coding exercise, and the editor has no Apex mode. The rehearsal section below says how to handle that.
Practice this role with an AI interviewer
Free plan: 2 interviews a month, free account, no card.
What the loop usually looks like
- Screen (30 min). Your projects and org size, certifications such as Platform Developer I, Flow versus Apex, and the security model: profiles, permission sets, roles and sharing. Expect "with sharing or without sharing?" early.
- Technical and scenario round (45 to 60 min). Write or talk through a trigger, make it bulk-safe, choose an async option for a callout, write a test class, explain LWC data access. Some teams share a screen and ask you to write Apex in a sandbox or editor.
- Lead or architecture round (45 to 60 min). For senior and lead roles: an integration design, large data volumes, trigger framework and code review standards, and how releases and coverage gates work in your pipeline.
What interviewers score
- Apex that is safe for 200 records at once
- Declarative first: knowing when a Flow is the better answer
- Choosing the right async tool and staying inside governor limits
- Test classes and deployments that hold up in review
What interviewers probe at each level
Platform Developer I or junior
Expect the core: bulkify this trigger, move the SOQL out of the loop, before or after trigger for this rule, when you would use a Flow instead, and how to write a test without SeeAllData. In LWC, what @wire needs from an Apex method. The follow-up is "what if 200 records come in at once?", so answer with collections from the start.
Mid level
The questions move to design inside the platform. Future, Queueable or Batch for this job, and why? How did you stop a trigger from running twice? How do you enforce field and object security in Apex? When does an LWC call Apex imperatively instead of using Lightning Data Service? Bring a real example of a limit you hit and how you fixed it.
Technical lead
Lead rounds are about standards and integration. How would you sync orders from an external system: REST callouts, platform events or bulk loads? How do you authenticate the callout? What does your trigger framework enforce, and what do you reject in code review? How do coverage and test runs fit into your release pipeline? Expect to defend a decision to keep logic in Flow or move it to Apex.
Mistakes that cost candidates this round
- Writing a trigger that handles Trigger.new[0] only, so the answer breaks the moment a data load sends 200 records.
- Putting SOQL or DML inside a for loop and not knowing which limit it will hit first.
- Reaching for Apex when a record-triggered Flow would do, and not being able to say why code was needed.
- Choosing @future for everything, including jobs that need chaining or sObject parameters.
- Writing tests that only chase the coverage number, with no assertions.
- Using SeeAllData=true because the test needed a record that it could have created.
- Answering "with sharing or without sharing?" as if the keyword covered everything. It decides which records the running user can reach, and object and field permissions still need their own check in Apex.
- Answering a lead-level integration question with a callout from a trigger, which has to be asynchronous.
Governor limits and bulkification: what every scenario answer needs
Salesforce runs many customers on shared infrastructure, so every transaction has limits. Trailhead’s unit on bulk triggers gives the two that come up in almost every interview: 100 SOQL queries per synchronous transaction, 200 in asynchronous Apex, and 150 DML statements per transaction. It also says triggers run on batches of 200 records, so a load of 400 records fires the trigger twice.
That is why interviewers listen for collections. A bulk-safe trigger collects the IDs it needs from Trigger.new into a set, runs one query with WHERE Id IN that set, builds a map, loops through the records using the map, and ends with one DML statement on a list. If you say "for each contact, query its account", the interviewer will ask what happens when a data loader inserts 10,000 contacts, and the honest answer is the 101st query throws a limit exception.
Know the context basics too. Trailhead says before triggers are for validating or changing values on the records being saved, and after triggers are for work that needs system-set values such as the record ID, or that changes other records. Records in Trigger.new are read-only in an after trigger. Calling addError() on a record stops it saving and rolls back the operation, except for records in a partial-success bulk DML call. Mid-level interviews also ask about order of execution, usually as "why did my trigger fire twice?", so read Salesforce’s own list of the save steps before the interview.
Sources: Trailhead, Bulk Apex triggers; Trailhead, Get started with Apex triggers
Future, Queueable, Batch or Scheduled: how do you choose?
Trailhead’s asynchronous Apex overview gives each tool a typical job. Future methods run on a separate thread and are common for web service callouts. Batch Apex handles large jobs that exceed normal processing limits, such as cleaning or archiving records. Queueable Apex works like a future method but adds job chaining and more complex parameter types. Scheduled Apex runs at a set time, for daily or weekly work. Salesforce now recommends Queueable over future methods.
Queueable answers score well when you name its advantages. Its member variables can be sObjects or your own Apex types, System.enqueueJob returns a job ID you can monitor, and a running job can enqueue one child job to chain work. The limits are also worth knowing: up to 50 jobs enqueued per transaction, and one child per running job. Async Apex also gets higher limits, for example 200 SOQL queries instead of 100, counted separately from the transaction that queued it.
Callouts from a trigger have to be asynchronous. Trailhead’s trigger unit shows a Queueable class that implements Database.AllowsCallouts, enqueued from the trigger. Before any callout works, the endpoint has to be authorised in the org, which Trailhead shows with Remote Site Settings.
Sources: Trailhead, Asynchronous processing basics; Trailhead, Control processes with Queueable Apex; Trailhead, Get started with Apex triggers; Trailhead, Apex web services callouts
What makes a test class pass a code review?
Trailhead says a deployment needs at least 75% of Apex code covered with every test passing, and each trigger needs some coverage of its own. Reviewers treat that as the minimum and look past it: does each test assert an outcome, does it test 200 records as well as one, and does it test the failure path?
Tests do not see org data by default, apart from setup objects such as User and Profile, so a good test creates its own records, usually in a @TestSetup method or a test data factory. Trailhead calls SeeAllData=true not a best practice. Wrap the code under test in Test.startTest() and Test.stopTest() so async work runs before your assertions.
Tests cannot make real callouts; a test that tries fails. Use Test.setMock with an HttpCalloutMock implementation, or a StaticResourceCalloutMock holding the response body, and assert on what your code did with the response.
Sources: Trailhead, Get started with Apex unit tests; Trailhead, Apex REST callouts (testing with mocks)
LWC questions: @wire, imperative Apex and Lightning Data Service
For Lightning Web Components, the usual question is how a component gets its data. Trailhead says that to wire an Apex method it must be annotated @AuraEnabled(cacheable=true) and be static and public or global, and that a cacheable method cannot perform DML. Call Apex imperatively when you need to control when the read happens or when you change records; the call returns a promise.
Use Lightning Data Service or the record form components first for single-record work. Trailhead suggests Apex when those do not fit, for example when several record operations must happen in one transaction. A strong answer explains why the component needed Apex at all.
Sources: Trailhead, Use Apex to work with data (Lightning Web Components)
How do I rehearse a Salesforce interview here?
In the technical round from this page, answer each scenario in the order a reviewer reads it: the trigger context, the set of IDs, the one query, the map, the one DML statement, then the test. Delivery feedback is speech-based: speaking pace, filler words (in English answers) and pauses, measured from your spoken answer.
A technical round for this title includes one coding exercise, and the editor’s languages do not include Apex or SOQL. You have two options. Switch the Language menu to Java, whose syntax is closest, and write the logic the way you would in Apex. Or type "no coding" in the practice chat before you start, and the round stays spoken. The exercise is a general programming task, not a Salesforce org, so nothing checks limits or runs your code.
For the lead round, run a system design session on an integration such as syncing orders from an ERP. It is scored on requirements analysis (20%), architecture design (30%), scalability & trade-offs (30%) and communication (20%).
10 salesforce developer interview questions and model answers
1. Write a trigger that updates a field on Account with the number of related Contacts whenever contacts are inserted or deleted.
Technical. What they are testing: Bulkification, one query and one DML, and the declarative alternative.
First I would ask whether a roll-up or a Flow covers it, since Contact to Account is a lookup, not master-detail, so a standard roll-up summary is not available. In code, an after insert and after delete trigger on Contact collects the AccountIds from Trigger.new or Trigger.old into a set, skipping nulls. One aggregate query, SELECT AccountId, COUNT(Id) FROM Contact WHERE AccountId IN :ids GROUP BY AccountId, gives the counts. I build a list of Accounts with the new count, setting zero for any ID missing from the results, and update the list once. I would also handle undelete and a contact moving accounts on update, and test it with 200 contacts across a few accounts.
2. What is wrong with this pattern: for (Contact c : Trigger.new) { Account a = [SELECT Id FROM Account WHERE Id = :c.AccountId]; }
Technical. What they are testing: Recognising SOQL in a loop and the limit it hits.
It runs one query per record. A trigger receives up to 200 records per batch, and the synchronous limit is 100 SOQL queries per transaction, so a bulk insert fails with a limit exception, and other automation in the same transaction uses up queries too. I would collect the AccountIds into a set first, query once with WHERE Id IN :accountIds into a map, then loop and read from the map.
3. After an Opportunity is closed won, you must send it to an external billing system. How do you build it?
Technical. What they are testing: Async choice for callouts, auth and failure handling.
Callouts cannot run synchronously from a trigger, so the trigger only detects the stage change and enqueues a Queueable that implements Database.AllowsCallouts, passing the opportunity IDs. I would choose Queueable over a future method because I can pass the IDs as a list, get a job ID to monitor, and chain a retry. The endpoint is authorised in the org, and I would store credentials outside the code. Failed calls get logged to a custom object with the response, so support can see and retry them. If deals close in bulk, the job sends them in batches the billing API accepts.
4. Future, Queueable, Batch or Scheduled Apex: which would you use to recalculate a score on two million records every night?
Technical. What they are testing: Matching the async tool to volume and timing.
Batch Apex, started by a Scheduled Apex class every night. Batch is built for jobs larger than normal limits: it splits the records into chunks and each execute call gets its own limits. The start method uses a query locator over the records that need recalculating, so I do not reprocess unchanged ones. Queueable would need me to chain dozens of jobs by hand, and a future method cannot take that volume. I would monitor it through AsyncApexJob and send failures to an error log.
5. How do you stop a trigger from running twice in the same transaction?
Technical. What they are testing: Recursion awareness and a sensible guard.
First I find out why it re-fires. Usually other automation on the same object updates the record again, or my own after trigger updates the records that fired it. If the second run is unwanted, I keep a static set of record IDs already processed in a handler class and skip them. I avoid a single static Boolean, because with more than 200 records the second batch of the same transaction would be skipped entirely. Where possible I move the field change into a before trigger, which needs no extra DML.
6. Write a test class for a trigger that calls an external service. What does it contain?
Technical. What they are testing: Testing practice beyond the coverage number.
A @TestSetup method that creates the accounts and contacts the test needs, no SeeAllData. A class implementing HttpCalloutMock that returns a fixed response, registered with Test.setMock. Then Test.startTest(), the insert or update of 200 records, and Test.stopTest() so the queued job runs. The assertions check what changed: the status field, the log record. A second test returns a 500 from the mock and asserts the error is logged and nothing is half updated. Coverage follows from that, and every trigger has coverage, which a deployment requires.
7. In an LWC, when do you use @wire and when do you call Apex imperatively?
Technical. What they are testing: LWC data access and cacheable rules.
@wire for reads that should load when the component loads and refresh when its parameters change. The Apex method must be @AuraEnabled(cacheable=true), static, and public or global, and it cannot do DML. I call Apex imperatively when the user triggers the action, like a button that saves, or when I need to control when the read happens. For a single record I would first try Lightning Data Service or a record form, and only write Apex when I need several records changed in one transaction.
8. A business analyst asks for a rule that a record-triggered Flow could do. Your team usually writes Apex. What do you recommend?
Situational. What they are testing: Declarative-first judgement and team standards.
If it is a simple field update or a related record create, I would build it in a Flow, because an admin can maintain it and it does not need a deployment with tests. I would move to Apex when the logic needs complex queries, callouts, heavy volume, or reuse across objects. What I would avoid is the same object having half its logic in Flows and half in triggers with nobody knowing the order. So I would write down where each rule lives and agree it with the team.
9. Tell me about a time you hit a governor limit in production.
Behavioral. What they are testing: Ownership, diagnosis from logs, and a lasting fix.
A data migration loaded 50,000 cases through the API, and our case trigger failed with too many SOQL queries. The debug log showed a query inside a helper method that was called once per record, which had been fine for years because users created cases one at a time. I paused the load, rewrote the helper to take a list and query once, and added a test that inserts 200 cases. The load finished the same day. After that, our code review checklist asked "has this been tested with 200 records?" on every trigger change.
10. As a technical lead, how would you integrate Salesforce with an ERP that owns product and price data?
Domain. What they are testing: Integration design, direction of data and failure handling.
I would start with which system owns which data and how fresh it must be. Prices owned by the ERP flow one way into Salesforce, so a scheduled bulk load or the ERP pushing changes through the API works, with an external ID on products so loads upsert instead of duplicating. Orders going back to the ERP need near real time, so a platform event or an async callout after the order is activated, with retries and an error object. Credentials stay out of code. I would agree volumes with the ERP team up front, because that decides whether we use the REST or Bulk API.
Frequently asked questions
What are scenario-based Salesforce developer interview questions?
Questions that give you a business rule and ask how you would build it: a trigger that rolls up child records, a callout after a stage change, a nightly recalculation. Interviewers want a bulk-safe design that stays inside governor limits, the async tool you would choose, a declarative alternative, and how you would test it.
Are Salesforce admin questions asked in a developer interview?
Some, yes. Expect the security model (profiles, permission sets, roles and sharing), validation rules and when a Flow is enough. They are asked to see whether you would choose configuration over code. An admin role interview goes much deeper on these and on user management.
Can I write Apex in the mock interview?
Not in an Apex mode. The editor has no Apex or SOQL option, so switch it to Java, which has the closest syntax, or ask for no coding in the practice chat and talk the trigger through. The spoken scenario questions are where most Salesforce rounds are decided.
Can I practise a Salesforce developer interview for free?
Yes. The free plan is 2 interviews a month, free account, no card, and a Salesforce technical round from this page uses one of those interviews, with its own report.
Keep practicing
- Solutions Architect mock interview
- Backend Developer mock interview
- Business Analyst mock interview
- Java Developer mock interview
- Technical interview practice with AI
- System design interview framework
- Behavioral interview practice with AI
- Coding interview preparation
- Free AI mock interview (2 interviews a month, free account, no card)
- AI mock interview tools compared
- Questions every round asks, with worked answers
- Practice in another language
- All role mock interviews