Salesforce Developer interview questions
100 real questions with model answers and explanations for Associate Developer candidates.
See a Salesforce Developer resume example →Practice with flashcards
Spaced repetition · Hunter Pass
Questions
A Salesforce org is an isolated Salesforce environment that holds a company’s data, configuration, users, and code.
- Production is the live org used by the business.
- Sandboxes copy selected production configuration or data for development and testing.
- Each org has its own ID and its own governor-limit context.
Why interviewers ask this: The interviewer is checking whether the candidate understands the basic boundary of a Salesforce environment.
Standard objects are supplied by Salesforce, while custom objects are created for a company-specific data model.
- Account and Contact are standard objects.
- A custom object has an API name ending in __c, such as Invoice__c.
- Both kinds can have fields, relationships, validation rules, and automation.
Why interviewers ask this: The interviewer is evaluating whether the candidate can recognize the two basic object categories and their API names.
A standard field comes with an object, while an administrator or developer adds a custom field.
- Name and CreatedDate are common standard fields.
- A custom field API name ends in __c, such as Renewal_Date__c.
- The field type controls allowed values, storage, and available operators.
Why interviewers ask this: The interviewer wants to confirm that the candidate can identify field ownership, naming, and type behavior.
A lookup relationship links one record to another without making the child fully dependent on the parent.
- The child can usually exist without a parent unless the field is required.
- Deleting the parent does not normally delete the child.
- Lookup supports links such as Contact to a custom Referral_Source__c record.
Why interviewers ask this: The interviewer is checking whether the candidate understands the loose form of Salesforce record relationships.
Master-detail makes the detail record dependent on its master and gives the master stronger control.
- A detail record must have a master.
- Deleting the master deletes its detail records.
- Roll-up summary fields on the master can aggregate detail values.
Why interviewers ask this: The interviewer is evaluating whether the candidate knows the lifecycle and aggregation consequences of master-detail.
A Salesforce record ID uniquely identifies a record within Salesforce.
- The 15-character form is case-sensitive.
- The 18-character form is case-insensitive and safer for external tools.
- Code should not infer an object from a hardcoded prefix when Schema methods can identify it.
Why interviewers ask this: The interviewer is checking practical understanding of ID formats and safe handling.
Apex provides strongly typed primitives such as Integer, Decimal, Boolean, String, Date, Datetime, and Id.
- The declared type limits which values and operations are valid.
- Decimal is appropriate for money calculations where precision matters.
- Id validates Salesforce ID-shaped values and can be used as a map key.
Why interviewers ask this: The interviewer is testing whether the candidate can choose basic Apex types for common values.
An Apex class groups state and behavior into a reusable type.
- Fields store class or instance data.
- Constructors initialize new instances.
- Methods expose operations such as calculating a discount or loading Accounts.
Why interviewers ask this: The interviewer is checking whether the candidate understands the basic structure and purpose of a class.
Parameters are typed inputs to a method, and the return type defines the value it sends back.
- A method declared Boolean must return a Boolean on every reachable path.
- A void method performs work without returning a value.
- Clear parameter names make calls such as calculateTotal(lines) easy to understand.
Why interviewers ask this: The interviewer is evaluating whether the candidate can read and define a simple method contract.
Apex access modifiers control where a class member can be used.
- private limits access to the defining class.
- public allows access within the same namespace, while protected also supports subclasses.
- global exposes an API outside the namespace and should be used only when that reach is required.
Why interviewers ask this: The interviewer is checking whether the candidate can choose the narrowest suitable visibility.
A static member belongs to the class, while an instance member belongs to one constructed object.
- A static method is called through the class name without new.
- Each instance can hold different values in its instance fields.
- Trigger handlers often use static methods because no per-instance state is needed.
Why interviewers ask this: The interviewer is evaluating whether the candidate understands ownership and invocation of class members.
A List stores an ordered collection and allows duplicate values.
- Indexes start at zero.
- List<Account> is a natural container for records returned by a SOQL query.
- Bulk DML accepts a list so many records can be saved in one statement.
Why interviewers ask this: The interviewer is checking whether the candidate recognizes ordered collection behavior and common Salesforce use.
A Set stores unique values and is useful for removing duplicates.
- Set<Id> prevents the same record ID from being collected twice.
- contains checks membership without scanning a list manually.
- A set of IDs can be used in a SOQL bind expression with IN.
Why interviewers ask this: The interviewer is evaluating whether the candidate can use uniqueness to simplify bulk code.
A Map stores key-value pairs and provides direct lookup by a unique key.
- Map<Id, Account> lets code find an Account by ID.
- A map avoids a nested loop when matching child records to parents.
- Query results can initialize a map when the sObject ID is the key.
Why interviewers ask this: The interviewer is checking whether the candidate can choose a map for efficient record matching.
Apex code should check a possibly missing value before dereferencing it.
- A relationship field or query result may be null even when the variable type is known.
- A guard clause can return early when required input is absent.
- Safe navigation with ?. can read through a nullable reference when a null result is acceptable.
Why interviewers ask this: The interviewer is evaluating whether the candidate can prevent basic null-pointer failures.
An sObject is the Apex representation of a Salesforce record.
- Account is a concrete sObject type with fields such as Name.
- The generic sObject type can hold records of different object types.
- Only fields selected by SOQL or assigned in code are available for normal access.
Why interviewers ask this: The interviewer is checking whether the candidate connects Apex objects to Salesforce records and fields.
insert creates records, while update saves changes to records that already have IDs.
- A successful insert populates each new record’s Id.
- One statement can process a list of records.
- A DmlException is thrown when all-or-none DML fails.
Why interviewers ask this: The interviewer is evaluating whether the candidate understands the two most common persistence operations.
delete removes records, while upsert inserts or updates each record based on a matching key.
- delete works with records or IDs that already exist.
- upsert uses Id by default or a chosen external ID field.
- An external ID lets imported data match Salesforce records without knowing Salesforce IDs.
Why interviewers ask this: The interviewer is checking whether the candidate understands removal and insert-or-update behavior.
An Apex transaction is one unit of work that either commits its successful changes together or rolls them back on an unhandled failure.
- A trigger and the DML that invoked it usually share the same transaction.
- Governor limits are measured per transaction.
- A savepoint and rollback can undo part of the work when code handles the error.
Why interviewers ask this: The interviewer is evaluating whether the candidate understands atomic work and its relation to limits.
Apex uses exceptions to report failures that code may catch and handle.
- A try block contains the operation that may fail.
- A catch block should handle a specific exception or add useful context.
- A finally block runs whether the operation succeeds or fails and should not hide the original error.
Why interviewers ask this: The interviewer is checking whether the candidate can describe basic exception control flow without swallowing failures.
Locked questions
- 21
What is SOQL used for?
queries - 22
When would you use SOSL instead of SOQL?
queries - 23
What is a bind variable in static SOQL?
queries - 24
How do you query a parent field from a child object in SOQL?
queries - 25
How do you query child records with their parent in SOQL?
queries - 26
What do aggregate functions do in SOQL?
aggregationqueries - 27
Why does Salesforce impose governor limits?
salesforcegovernor-limits - 28
Name common synchronous Apex governor limits.
governor-limitsapex - 29
What does bulkification mean in Apex?
bulkificationapex - 30
Which trigger contexts are available for insert, update, delete, and undelete?
triggers - 31
You need to normalize a field on the record currently being saved. Which trigger timing fits?
normalizationtriggers - 32
Logic needs the ID assigned by an insert before creating related data. Which trigger timing fits?
triggers - 33
What are Trigger.new and Trigger.old?
triggers - 34
Why do teams commonly keep one trigger per object and move logic to a handler?
triggers - 35
How can a trigger reject an invalid record?
triggers - 36
When would you choose Salesforce Flow instead of Apex?
salesforceautomationflow - 37
What is a record-triggered Flow?
triggersautomationflow - 38
Which files make up a basic Lightning Web Component bundle?
componentslightninglwc - 39
How does an LWC template render data and conditions?
lightning - 40
How does JavaScript state update an LWC template?
lightningjavascript - 41
What does the LWC .js-meta.xml file control?
lightning - 42
What does @api mean in an LWC?
lightningapi - 43
How does the wire service load data in LWC?
lightningwire-service - 44
When should LWC call Apex imperatively?
lightningapex - 45
How does a child LWC notify its parent?
lightning - 46
How do profiles and permission sets differ?
permissions - 47
How do roles and sharing differ from CRUD and field-level security?
sharing - 48
What does a basic Apex test look like?
apex-testingapex - 49
How do metadata, Salesforce CLI, scratch orgs, and source deployment fit together?
deploymentsalesforce-cliscratch-orgs - 50
What are the basic purposes of Salesforce REST API and Bulk API?
restbulk-apisalesforce - 51
An Apex method may leave Account acc as null and then reads acc.Name. How do you fix it?
fundamentalsapex - 52
You must collect Contact IDs, remove duplicates, and then find each Contact by ID. Which collections do you use?
- 53
A query assigned directly to Account acc throws List has no rows for assignment to SObject. What should change?
queriesdata-model - 54
A search method concatenates user text into a dynamic SOQL WHERE clause. How do you make it safe?
queries - 55
Write the shape of a SOQL query that returns Contacts with each Account name.
queries - 56
You need Accounts and only their open Opportunities. How do you structure the SOQL query?
queries - 57
An insert of ten records fails because one record violates a validation rule. How can valid rows still be saved?
validation - 58
A loop over 200 Contacts runs one Account SOQL query per Contact. How do you remove the limit risk?
queries - 59
A loop updates each Opportunity with a separate update statement. How do you bulkify it?
- 60
A Contact trigger works for one record but fails when Data Loader sends 200. What should you inspect first?
triggers - 61
A before update trigger changes Trigger.new records and then calls update Trigger.new. Why is that wrong?
triggers - 62
A trigger must create a child record using the new parent ID. Should it run before insert or after insert?
triggers - 63
An after update trigger updates the same object and executes twice. How do you stop unwanted repeat work?
triggers - 64
You have Opportunities and queried Accounts, but the code uses nested loops to match AccountId. What is the local fix?
- 65
A page only needs the number of open Cases, but Apex queries every Case. What should change?
queriesapex - 66
A record-triggered Flow creates a related record, but users see an unhandled error when creation fails. What should you add?
triggersautomationflow - 67
A record-triggered Flow updates a record after every update, even when nothing relevant changed. How do you narrow it?
triggersautomationflow - 68
A parent LWC passes record-id, but the child’s recordId stays undefined. What should you check?
lightningfundamentals - 69
An LWC pushes a row into an array, but the template does not reliably show it. What is the safer update?
lightning - 70
A wired Apex method should reload when recordId changes, but it only ran once. What is missing?
apex - 71
A wired LWC shows an empty panel when Apex fails. How should the component expose the problem?
componentslightningapex - 72
A Save button must call Apex once and show a spinner until completion. How would you structure it?
apex - 73
A child LWC dispatches a selected event, but the parent handler never runs. What do you inspect?
lightning - 74
An LWC list rerenders with the wrong row state after sorting. What template issue is likely?
lightningalgorithms - 75
A component updates a record imperatively, but wired Lightning Data Service data remains stale. What should it do?
componentslightning - 76
An LWC click handler seems not to run. What is a focused browser-side debugging sequence?
lightning - 77
An Apex method fails only for one user. How do you use a debug log without guessing?
apex - 78
A user can open an Account but an Apex action exposes a field hidden by field-level security. What is the mismatch?
sharingapex - 79
An Apex class returns records a user cannot see in the UI. What class declaration should you inspect?
apex - 80
A user still sees Salary__c after its profile field permission was removed. What should you inspect?
- 81
An Apex test passes in a sandbox because it queries an existing Account, but fails elsewhere. How do you fix it?
queriesapexdeployment - 82
A test enqueues a Queueable job, but its assertions run before the job changes data. What should change?
async-apexdata-structures - 83
An Apex test for an HTTP callout fails because tests cannot call the real endpoint. What do you add?
apex-testinghttpendpoints - 84
How would you test that a trigger handles 200 records without querying inside a loop?
queriestriggers - 85
A deployment fails with insufficient Apex code coverage. What should a junior check?
coveragedeploymentapex - 86
An Apex class referencing Invoice__c deploys, but compilation says the object is invalid in the target org. What is likely missing?
deploymentapex - 87
A permission set deployment fails because it references a new field. What should be included and validated?
validationpermissionsdeployment - 88
A Salesforce CLI deploy went to the wrong org. How do you prevent repeating it?
deploymentsalesforce-clisalesforce - 89
How do you check a small source deployment before actually applying it?
deployment - 90
A scratch org cannot create a feature-specific component that works in production. What configuration should you inspect?
configscratch-orgscomponents - 91
A REST client receives HTTP 400 when creating an Account. What do you inspect first?
resthttp - 92
A Salesforce REST request returns 401, while another user gets 403. What is the difference?
salesforcerest - 93
What should a successful REST create response contain, and how should the client handle it?
rest - 94
You need to load 100,000 Contacts and receive row-level results. What is the basic Bulk API flow?
bulk-apiautomation - 95
An Apex HTTP callout receives a 500 response. Should the code deserialize it as a success payload?
httpapex - 96
A JSON response has customerName and active fields. How do you parse it into Apex cleanly?
apex - 97
A method inserts an Account and then an invalid Contact causes unhandled DML failure. What happens to the Account?
data-model - 98
A trigger uses addError, but users cannot tell which field to fix. How can the feedback improve?
feedbacktriggers - 99
A Visualforce page shows an apex:inputField for Contact, but clicking Save does not persist the edit. What should you check?
visualforceapex - 100
A transaction tries to update a User and an Account and fails with a mixed DML error. What is the beginner-level fix?
transactionsdata-model