1. What is an Object?
An object in Salesforce is a fundamental data structure used to store and manage data. Objects can represent various types of entities such as standard objects (like Accounts, Contacts, Opportunities) or custom objects (created by users to suit their specific needs). Objects contain fields to store data and can also have related records through relationships.
2. What is the difference between master details and lookup relationships?
3. What is the junction object?
A junction object is a custom object in Salesforce used to create a many-to-many relationship between two objects. It contains two master-detail relationships (or lookup relationships) to the objects you want to relate. Junction objects are typically used to model complex relationships that can’t be represented directly by a single relationship.
4. What is the difference between role and profile?
5. What is the difference between a profile and a permission set?
6. What is the sharing rule?
A sharing rule is used to extend access to records that the organization-wide default sharing settings might restrict. It’s a way to selectively share records with specific users or groups based on predefined criteria.
Don't forget to check out: Interview Question Part – 3
7. What is the difference between With sharing and without sharing?
8. What is the wrapper class?
A wrapper class is a custom Apex class that is used to hold and manage multiple related data elements from different sources. It’s commonly used to bundle data from multiple objects or query results and pass them to Visualforce pages or Lightning components.
9. what is the batch?
A batch class in Salesforce is used to process a large number of records in smaller, manageable chunks (or batches). It’s particularly useful when you need to perform operations on a large number of records that might exceed governor limits.
10. can we call batch class from the batch class?
Yes, you can call one batch class from another batch class. This can be useful for chaining batch jobs to execute in a specific order.
11. What is the way to call batch class?
You call a batch class by creating an instance of the batch class and then invoking the
Database.executeBatch() method, passing in the instance as a parameter.
12. What is the validation rule?
A validation rule is a business logic rule that you define to enforce certain data entry standards or consistency. It prevents users from entering data that doesn’t meet the specified criteria.
13. What is the record type?
A record type is a way to categorize and distinguish different types of records within an object. Each record type can have its own set of page layouts, picklist values, and business processes.
14. What is the difference between custom settings and custom metadata?
Custom Settings are used for storing static data, while Custom Metadata is used for storing configuration data that can be easily deployed between Salesforce environments. Custom Settings can be profile-specific, while Custom Metadata is available to all users. Choose based on your data's nature and deployment needs.
15. What is the use of wire in LWC?
16. What are the different types of controllers on the vf page?
Ans. In Visualforce pages, you can use three types of controllers:
- Standard Controller: Represents a standard object, like an Account or Contact.
- Custom Controller: A user-defined Apex class that extends the
- Extension Controller: A user-defined Apex class that extends or enhances the functionality of a standard or custom controller.
17. What is the difference between render and rendered in vf page?
18. What are the benefits of using vf pages?
Visualforce pages in Salesforce offer benefits such as custom user interfaces, integration with data, control over data presentation, and the ability to incorporate business logic.
19. How can we call the parent component to the child component?
Communication from a child component to a parent component in Lightning Web Components can be achieved by using events.
20. How can we pass the data from the parent to a child component?
Data is passed from a parent component to a child component in LWC through component properties (attributes).
21. What are the context variables in trigger in Salesforce?
Ans. These context variables help you determine various aspects of the trigger execution, such as the type of trigger event, the records being processed, and more. Here are some commonly used context variables in Salesforce triggers:
Trigger.isBefore: This Boolean context variable is
trueif the trigger is executing in the "before" context, meaning before the records are saved to the database.
Trigger.isAfter: This Boolean context variable is
trueif the trigger is executing in the "after" context, meaning after the records are saved to the database.
Trigger.isInsert: This Boolean context variable is
trueif the trigger is executing due to an insert operation.
Trigger.isUpdate: This Boolean context variable is
trueif the trigger is executing due to an update operation.
Trigger.isDelete: This Boolean context variable is
trueif the trigger is executing due to a delete operation.
Trigger.isUndelete: This Boolean context variable is
trueif the trigger is executing due to an undelete operation (recovering a deleted record).
Trigger.new: This context variable holds a list of the new versions of the records being processed in the trigger. In an update trigger, this holds the updated values.
Trigger.newMap: This context variable holds a map of the new versions of the records being processed, where the keys are record IDs and the values are the record objects.
Trigger.old: This context variable holds a list of the old versions of the records being processed in the trigger. In an update trigger, this holds the values before the update.
Trigger.oldMap: This context variable holds a map of the old versions of the records being processed, where the keys are record IDs and the values are the old record objects.
Trigger.size: This context variable holds the total number of records in the trigger context. It's a count of the records in
Trigger.operationType: This context variable provides the type of operation that caused the trigger to fire. It can have values like
22. Why we use Test.StartTest() and Test.StopTest()?
Test.StopTest() are methods used in unit tests. They are used to define a block of code that is separate from the rest of the test context. The key purpose of these methods is to reset governor limits. Salesforce enforces certain limits on DML operations, SOQL queries, and more. Wrapping code between
Test.StopTest() allows you to reset the limits specifically for that block of code, enabling you to test the impact of your logic without being constrained by the governor limits.
23. What is the purpose of @future Annotation?
@future annotation is used in Salesforce Apex to indicate that a method should be executed asynchronously in the background. It allows you to offload long-running or potentially resource-intensive operations to avoid impacting the immediate user experience. Methods annotated with
@future are processed in a separate context and have their own governor limits.
24. What is the mixed DML error?
The “Mixed DML Operation” error occurs in Salesforce when you try to perform a transaction that involves a mix of both setup (metadata) objects and non-setup (standard/custom) objects in a single context. This usually happens when you perform DML operations on both types of objects within the same transaction, and Salesforce enforces a restriction to prevent certain types of mixed operations due to potential security concerns.
25. How can resolve the mixed dml error?
To resolve the mixed DML error, you need to ensure that DML operations on setup objects and non-setup objects are separated into different transactions. Here are a few approaches:
- Use Future Methods or Queueable Jobs: You can use
@futureannotated methods or Queueable Apex to move the DML operations on setup objects to a separate asynchronous context.
- Use Asynchronous Apex: If possible, move one set of DML operations to an asynchronous context using methods like Queueable or Batch Apex.
Check out another amazing blog by Aman here: How to Register for the Salesforce Exam?
I hope you like this blog and if you want any help let me know in the comment section.
Stay tuned, there is way more to come! Follow me on LinkedIn, Instagram, and Twitter. So you won’t miss out on all future articles.
Originally published at https://amansfdc.com.