Looking for Salesforce Development Interview questions and answers? In this series of blogs and articles, Cloudely experts present you the Salesforce interview questions and answers, real-time scenarios, use cases, errors, turnarounds and more. This article is the first of this series. We hope you will find it helpful.
1. What is asynchronous Apex? How many types of asynchronous Apex are there in Salesforce?
Ans: Asynchronous Apex is used to run processes in a separate thread when the resources are available for execution. There are four types of asynchronous operations available in Salesforce.
- Future Methods
- Batch Apex
- Queueable
- Scheduled Apex
2. Can we call a future method from another future method?
Ans: No, we cannot call a future method from another future method.
3. What are the best practices of writing Apex?
Ans: Following are the list of best practices of writing Apex:
- Always bulkify the code for future reference.
- Avoid SOQL queries inside the loop.
- Don’t use hardcoded values, and try to use dynamic values.
- Single trigger per single object.
- Consider the order of execution while writing any code.
4. How many types of relationships are available in Salesforce?
Ans: There are different relationships available in Salesforce:
- Master-Detail
- Lookup Relationship
- Self- Relationship
- External lookup relationship
- Many to Many relationship(Junction Object)
- Hierarchical relationship
5. Can we create rollup summary fields in lookup relationships?
Ans: No, we cannot create rollup summaries in lookup relationships. It’s possible to create rollup summaries only in master detail relationship
6. How many fields can we add in a compact layout?
Ans: We can add up to a maximum of 10 fields in a compact layout.
7. How to call a class in process builder?
Ans: If we have to call a class in a process builder, we have to declare that class with the annotation of @invocablemethod.
8. What are before and after triggers?
Ans: The triggers which run before the save of a record, we call them as before triggers and the triggers which run after saving the record are after triggers.
9.Can we bypass a validation rule?
Ans: Yes, we can bypass a validation rule to run for the records which are created newly instead of running for all the records.
10. What is the use of the test setup method?
Ans: We can use the test setup method to create some data for test class and we can use that data in any other method in test class.
Suggested Reading: Salesforce Technical Questions and Answers
11. What is test.starttest and test.stoptest?
Ans: Suppose if we want to run one method as asynchronous / have some long complex operations (which has multiple SOQL Â queries) then we will use test.starttest and test.stoptest to consider it as separate thread of execution to overcome the too many SOQL queries limit exception.
12. What is a dependent picklist?
Ans: If we want to control a picklist values based on selection of value in another picklist then we will use a dependent picklist.
13. How to achieve many to many relations in Salesforce?
Ans: For achieving many to many relationships, we need to have a junction object in between. Consider the following example:
14. What are the methods in batch Apex? Can we write a batch Apex by excluding any one of the methods?
Ans: There are three methods in batch Apex. They are
- Start
- Execute
- Finish
We cannot write a batch Apex without any of these methods. Since it’s an interface, we have to implement all the methods provided by the batch.
15. How many types of sharing rules do we have in Salesforce?
Ans: There are basically two types of sharing rules in salesforce.
- Owner- based sharing rules.
- Criteria- based sharing rules.
16. What is the use of a change set, and what is the max size of a change set?
Ans : Change set is a Salesforce build in feature to move the changes from one sandbox to another sandbox, which are interconnected. At most, we can have 10,000 components in a change set.
17. How many records can we retrieve using a SOQL query?
Ans : Using SOQL, we can retrieve a maximum of 50,000 records at a time.
18. Can we revoke the access of a user using a permission set?
Ans : No, we can extend the levels of permissions of a user using permission set, but cannot revoke the permissions.
19. What is the difference between a custom controller and standard controller?
Ans : The standard controller is generated by Salesforce for all of the objects. Whereas, a custom controller is defined by us with our custom logic using Apex.
20. What is the benefit of using custom metadata and custom labels?
Ans : By using custom metadata/ Custom Label, we can get the data stored in Custom metadata/ custom labels without writing any SOQL queries.
Learn Salesforce with Cloudely
Salesforce technology has immense demand in the market. It’s the right time to learn and get certified in Salesforce. Besides, irrespective of your technical background, you can learn Salesforce with ease under our expert guidance.
Enroll in our Salesforce online training programs.
Found this article informative? Share this article.
Looking for expert answers to Salesforce questions? Send them to salesforce@cloudely.com. Our Salesforce experts will answer your queries.