Your Ultimate Salesforce Developer Interview Prep: 38 Questions & Answers

Aug 6, 2025Abhishek razy5 min read

Triggers

  • Explain the Order of Execution in a Trigger Context.

    • When a record is inserted, Salesforce follows a specific sequence. This includes Before triggers, Validation rules, After triggers, Assignment rules, Auto-response rules, Workflow rules, Escalation rules, and Post-commit logic.

  • When to Use Before vs. After Triggers.

    • Use Before triggers when you need to update or validate the same record that initiates the trigger. Use After triggers when you need to access the record's ID or perform DML operations on related records.

  • Troubleshooting a Bulk Trigger Failure.

    • Common issues include SQL or DML operations inside a loop, lack of Bulkification, and missing error handling.

  • Trigger to Create a Contact When an Account is Created.

    • An after insert trigger on the Account object can create a new Contact record and associate it with the new Account.

  • Invoking Apex from Flow.

    • For complex logic not supported in Flow, use an @InvocableMethod Apex class and invoke it from a Flow.

LWC and Front-End

  • Implementing a Datatable with Row Actions in LWC.

    • Use lightning-datatable, define columns with actions, handle onrowaction, and use Apex methods for operations.

    • Communication Between LWC Components.

      • Parent to Child: Use @api properties.

      • Child to Parent: Use custom events with this.dispatchEvent(new CustomEvent('eventname', { detail: this.value })).

    • Implementing a Datatable with Row Actions in LWC.

      • Use lightning-datatable, define columns with actions, handle the onrowaction event, and use Apex methods for data operations.

    • How to Handle Pagination in LWC?

      • Use SOQL OFFSET or server-side logic to fetch a limited number of records, then display the pages using JavaScript logic and navigation buttons.

    • Scenario: Conditional Rendering in LWC.

      • Use template directives like if:true and if:false. For example, show an error message only if a user's input is invalid or a flag is set to true.

    • How Do You Create a Reusable LWC Component?

      • Design with input parameters using @api, modular logic, and slots for content projection. A modal component used across multiple screens is a good example.

    • Real-Time Use Case for AuraEnabled(cacheable=true).

      • Used to cache server-side data on the client for better performance in LWC. An example is loading a read-only data list, like a list of countries.Data, Security, and Integrations

Use Case for Apex REST API.

  • Expose Apex as a REST API for integrations. An external system could send lead data to a Salesforce endpoint, which then creates a new Lead.

  • How to Ensure Field-Level Security in Apex?

    • Use schema methods like isAccessible(), isCreateable(), and isUpdateable() to check for FLS before accessing or modifying fields.

  • What is a Platform Event? Give a Use Case.

    • Platform Events are used for event-driven architecture. A use case is to notify external systems in real-time when a Case is escalated.

  • Use Case for Dynamic SOQL.

    • Use Dynamic SOQL when field names or conditions are not known until runtime. An admin could select fields to export, and the query is built dynamically.

  • What is a Platform Event? Give a Use Case.

    • Platform Events are used for event-driven architecture. An example use case is to notify external systems in real-time when a Case is escalated.

  • Real-Time Use of Custom Metadata Types.

    • Used to store configuration data like discount rates, thresholds, or business rules without hardcoding. They can be accessed via SOQL without consuming governor limits.

Asynchronous and Bulk Processing

  • Difference Between Synchronous and Asynchronous Apex.

    • Synchronous operations are executed immediately (e.g., triggers), while asynchronous operations (Queueable, Batch, Future) run in the background for long-running or resource-heavy tasks.

  • When Would You Use Batch Apex?

    • Use Batch Apex when processing over 50,000 records asynchronously. For example, to clean up old Cases or recalculate scores for all Leads.

  • Scenario for Using Queueable Apex.

    • Use Queueable Apex for processing large sets of data asynchronously with complex logic and chaining capabilities. An example is processing large invoices after an Order is created.

  • Use Case for Wrapper Class in Apex.

    • A wrapper class is a custom class that wraps multiple data types into a single object. It's often used in Visualforce or LWC to handle complex data structures, such as displaying a list of accounts with a checkbox.

Flows and Declarative Tools

  • Scenario: Auto-Populate Fields in Screen Flow.

    • Use a Record Lookup or Get Records element to fetch default values, assign them to variables, and map them to the screen components.

  • Real-Time Validation Rule vs Apex Validation.

    • Validation Rules are declarative and user-friendly. Use Apex validation for complex logic, cross-object checks, or conditions not possible in formulas.

  • Screen Flow: Log a Case for a Selected Contact.

    • The process would be:

      • Record Picker to select a Contact.

      • Capture Case details.

      • Create a Case using the Contact ID.

      • Display a confirmation screen.

Miscellaneous

  • What is the Purpose of Custom Labels?

    • Custom Labels store text values for reuse in Apex, LWC, and Visualforce. They support multi-language and are easier to update.

  • Use Cases for Static Resources.

    • Used for: custom JavaScript/CSS in Visualforce, hosting images and files, and referencing in LWC via $Resource.

  • Difference Between Change Set and Metadata API.

    • Change Sets are UI-based, org-to-org deployments. Metadata API is script-based, supports CI/CD, and all metadata types.

  • Writing Effective Test Classes.

    • Minimum 75% code coverage, 100% trigger coverage, use of Test.startTest(), Test.stopTest(), and reliable test data creation.

  • Difference Between Standard Controller and Custom Controller.

    • Standard Controller handles one object with built-in functions. Custom Controller gives full programmatic control over logic and data access.

  • Updating Parent Record After Child Creation.

    • In an After Insert trigger on the child object, collect parent Account IDs, query the Accounts, update the rating field, and perform DML.

  • Prevent Duplicate Lead Creation Based on Email.

    • Use a trigger or a duplicate rule. A trigger would query existing Leads with the same email and prevent the new Lead from being inserted.

  • Querying Contacts with a Specific Email Domain.

    • Use a SOQL query like: [SELECT Id, Name FROM Contact WHERE Email LIKE '%@gmail.com' AND AccountId = :accId].

Comments (0)

Loading comments...

Leave a Reply