Salesforce Developer Interview Questions

Prepare for your next Salesforce developer interview with these top questions and expert answers. Covers Apex, Lightning, integrations, and real-world scenarios to help you succeed.

Admin (Configuration & Setup)

Q:1. When would you choose a Lookup relationship over a Master-Detail and why?

Ans: You choose a Lookup relationship over a Master-Detail relationship when you want to create a loose association between two objects, meaning:

  • Optional Relationship: In a Lookup, the child record can exist without being linked to a parent, unlike Master-Detail where the parent is mandatory.
  • No Cascade Deletion: Deleting the parent does not delete the child record.
  • Separate Security and Ownership: The child record does not inherit the parent’s sharing settings or owner. You manage them independently
  • No Roll-Up Summary: You cannot create roll-up summary fields on the parent object in a Lookup relationship.

Similarly, you can answer why you would choose a Master-Detail relationship over a Lookup by simply reversing the above points.

Q:2. What is the difference between Record Types and Page Layouts?

Ans: Record Types and Page Layouts are both used in Salesforce to control how data is displayed and entered, but they serve different purposes. Here’s how they differ

Record Types – Control Business Logic

  • Allow you to create different business processes, picklist values, and record categories for the same object.
  • Useful when you have different types of users or use cases for the same object (e.g., B2B vs B2C opportunities).

Page Layouts – Control User Interface

  • Determine what fields, sections, buttons, and related lists users see on a record detail or edit page.
  • You can assign different page layouts to different profiles through Record Types.
  • Control the visual experience, not the business logic.

How They Work Together

  • Record Types define the type of record, and
  • Page Layouts define how that record looks to the user based on profile and record type.

Development (Apex & Triggers)

  1. What are the differences between Queueable and Batch Apex? Which one would you use for retry logic?
  2. What is the use of Database.SaveResult[] and how would you implement error handling using it?
  3. Explain a real-world use case where you used Custom Metadata Types in your Apex logic.
  4. Can we call a future method from a trigger? Why or why not?
  5. What are governor limits? Name a few important ones
  6. What are the best practices to avoid recursive triggers?
  7. How to handle bulk operations in triggers?

Lightning Web Components (LWC)

  1. How would you implement conditional rendering in LWC based on dynamic data?
  2. What are lifecycle hooks in LWC, and when do you use renderedCallback()?
  3. How would you optimize component performance when working with large datasets?

Integration (REST, Platform Events, Named Credentials)

  1. What is the difference between a REST callout and a Named Credential?
  2. Share a scenario where you handled two-way communication between Salesforce and an external system.
  3. Explain how to create a custom REST API in Salesforce and expose it to external systems.

Scenario-Based Questions

  1. A user reports that their LWC component is not updating after a DML operation – how would you troubleshoot it?
  2. How would you ensure data integrity when multiple users are updating the same record from different UI components?
  3. You need to deploy Apex changes and LWC components to production without downtime. How would you plan the deployment?

Leave a Comment

Your email address will not be published. Required fields are marked *