Salesforce Interview Question Answers

1. Difference between Process Builder and Flow

  • Process Builder: Automates simple processes like updating fields, sending emails, and invoking Flows. Limited in flexibility compared to Flows.
  • Flow: A more powerful tool that can handle complex logic, data manipulations across objects, and user interactions through screens.

2. How does sharing work in Salesforce?

  • Sharing determines record visibility. It can be configured using:
    • OWD (Organization-Wide Defaults): Base level of access.
    • Role Hierarchy: Extends access upwards in the hierarchy.
    • Sharing Rules: Grants additional access based on criteria or ownership.
    • Manual Sharing: Individual record-level access.
    • Apex Sharing: Programmatically sharing records.

3. What is the difference between roles and profiles?

  • Roles: Control record-level visibility through the Role Hierarchy.
  • Profiles: Define user permissions like object access, field-level security, and system-level permissions.

4. Can we create roll-up summaries for lookup relationships?

  • No, roll-up summaries are only supported for Master-Detail relationships. However, similar functionality can be achieved for Lookup relationships using Apex Triggers or Declarative Lookup Rollup Summaries (DLRS).

5. When would you use a validation rule over automation tools?

  • Use a Validation Rule when you need to enforce data integrity by preventing invalid data from being saved. Automation tools (like Flow or Process Builder) are used to automate processes after the record is saved.

6. How does Order of Execution work in Salesforce?

  1. System validation rules.
  2. Executes before triggers.
  3. Custom validation rules.
  4. Executes after triggers.
  5. Executes assignment rules.
  6. Executes auto-response rules.
  7. Executes workflow rules.
  8. Executes escalation rules.
  9. Commits data to the database.
  10. Executes post-commit logic (e.g., sending emails).

7. Can we call a future method from a trigger?

  • Yes, you can call a future method from a trigger, but it is not recommended due to governor limits and potential chaining issues. Avoid nested asynchronous calls.

8. What is the difference between System Mode and User Mode?

  • System Mode: Apex code executes with full access to all objects and fields, bypassing user permissions.
  • User Mode: Enforces the permissions and sharing rules of the current user.

9. Best practices for designing record-sharing solutions

  • Use OWD settings for baseline access.
  • Utilize Role Hierarchies to extend access where necessary.
  • Create Sharing Rules for additional sharing needs.
  • Avoid overusing Manual Sharing, as it can be hard to maintain.
  • Use Apex Sharing for complex requirements.

10. How to schedule a Batch Apex job?

  • Use the System.schedule method or implement the Schedulable interface. Example:apexCopySystem.schedule('Batch Job', '0 0 12 * * ?', new MyBatchClass());

11. What are lifecycle hooks in LWC?

  • Lifecycle hooks are methods called during the lifecycle of a Lightning Web Component:
    • connectedCallback(): Runs when the component is inserted into the DOM.
    • renderedCallback(): Runs after the component is rendered.
    • disconnectedCallback(): Runs when the component is removed from the DOM.

12. Explain Governor Limits with examples

  • Governor limits enforce resource usage per transaction to ensure fair usage in the multi-tenant environment. Example:
    • SOQL queries: Max 100 per transaction.
    • DML operations: Max 150 per transaction.

13. Debug logs analysis for Bulk DML operations

  • Focus on:
    • Number of records processed.
    • SOQL queries and DML statements per transaction.
    • Verify if logic is bulkified (e.g., avoid using SOQL in loops).

14. Can we implement multi-currency in Salesforce? If yes, how?

  • Yes, enable the Multi-Currency feature in Salesforce. Then:
    • Define corporate currency.
    • Assign user-specific currencies.
    • Use advanced currency management for dated exchange rates.

15. How would you approach automating lead assignment?

  • Use Lead Assignment Rules to define criteria and automatically assign leads to users or queues. Optionally, use Flow for more complex scenarios.

Sign up for our Newsletter

To get the blog notification by email subscribe to the GradX Academy Newsletters.

Book Your Seat For FREE

GradX Enquiry Form

By creating an account I have read and agree toTerms and Privacy Policy