Salesforce Developer Interview Questions and Answers Pdf
1. What are the extensions?
Answer: A controller extension is an Apex class that extends the functionality of a standard or custom controller. Use controller extensions when: You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete. You want to add new actions. You want to build a Visualforce page that respects user permissions. Although a controller extension class executes in system mode, if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, in which permissions, field-level security, and sharing rules of the current user apply.
2. How to handle the null pointer exception in salesforce?
Answer: Null Pointer Exception is a runtime exception. Null Pointer Exception has thrown when an application attempts to use object reference having the null value.
Ex. String a; a.toLowerCase(); //Since a is null,this call causes a null pointer exception
3. What are the Exception handling types in sfdc except try-catch block?
- Async Exception
- Callout Exception
- Dml Exception
- Null Pointer Exception
- XML Exception
- Security Exception
- Type Exception
- String Exception
- SObject Exception
- Search Exception
4. What creative solutions have you come up with to navigate around a governor limit?
Answer: Gov Limits are limitations prevent certain functionality to be accomplished within SFDC.
5. How many visual force pages do you write a day?
Answer: 1000 a day would be a large quantity.
6. What % of your time do you spend on Declarative(point and click)development and what % do you spend on programmatic (custom code) development?
Answer: The more Programmatic the better.
7. What is field-level security in the salesforce context?
Answer: Field Level Security refers to the ability to provide access based on a profile of the user. For instance, a user can set the Field Security Level to View or Edit at the time of creating a field.
8. What may be reason truncate button is not visible on Custom Object?
- Are referenced by another object through a lookup field or that is on the master side of a master-detail relationship
- Are referenced in a reporting snapshot
- Have a custom index or an external ID
9. What are the different types of states in Salesforce?
Answer: There are two types of accounts in Salesforce: Personal accounts and Business accounts. In a personal account, the primary goal will be the individual’s name and coming to a business account, the primary consideration will be the name of the organization.
10. What are the controllers?
Answer: A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user. Learn Salesforce Training Online From Real-Time Experts.
11. What are Dependent Fields?
Answer: Dependent Fields can be attached to filters. That is, a condition can be set for displaying the value in a field, for example, > 100, etc. This was just a glimpse of important Salesforce Interview Questions. It is an extensive platform and calls for a complete course to achieve expertise. Stay in touch for more valuable feeds.
12. What are some best practices when writing test classes?
Best Practices for writing Apex Test classes in Salesforce:
- All test methods should reside in a separate class from the class in which the method being tested resides.
- These classes should be appended with the word Test followed by the name of the class being tested, e.g. OpportunityServicesTest.
- These classes should all use the @isTest annotation.
- Each method in the production class should have, at a minimum, one corresponding test method in its test class and should be appended by “test”
- There should be a minimum of the “Null Pointer Exception test” as part of negative testing for each method, especially the methods that accept parameters.
- A method without an assert statement is not considered a test method. A large number of relevant assert statements increase confidence in the correct behavior of business logic.
- There should be a comment with each assert statement explaining what is being tested and what the expected output is
Only use sites(SeeAllData = true) on class methods in exceptional cases where there are sObjects that doesn’t allow DML operation e.g. PriceBook creation
- No hardcoded ids of any sObject in any test method.
- All test data creation should be done from a Utility class. This allows for a streamlined creation of test objects that adhere to all the validation rules.
13. What is the difference between Force.com and Salesforce.com?
Answer: Force.com is the PaaS vertical that forms the foundation for the code, database fetching, and UI development. Salesforce.com, being a superset is the SaaS vertical referring to the CRM functionality
14. Difference between roles and profiles?
- The objects the user can access
- The fields of the object the user can access
- The tabs the user can access
- The apps the user can access
- The page layout that is assigned to the user
- The record types available to the user
Record level access can be controlled by Role. Depending on your sharing settings, roles can control the level of visibility that users have into your organization’s data. Users at any given role level can view, edit, and report on all data owned by or shared with users below them in the hierarchy, unless your organization’s sharing model for an object specifies otherwise.
15. Validation for deduplication?
16. What does the View State represent in a Visualforce page?
Answer: Visualforce pages that contain a form component also contain an encrypted, hidden form field that encapsulates the view state of the page. This view state is automatically created, and as its name suggests, it holds the state of the page – a state that includes the components, field values, and controller state.
17. What do you know about CRM?
Answer: CRM(Customer Relationship Management) which is a software that makes the work easier for a salesperson basically to enter all his daily activities into the system instead of entering it in the excel and sending it across. Also, it helps to gather data on the prospects and customers to interact with them.
18. What are permission sets and how do they differ from profiles?
Answer: Permission sets and Profiles are very similar. They both contain similar permissions that can be assigned to a user so that they can do things like run reports or CRUD accounts or read and edit fields.
Where Profiles and Permission Sets tell you whether a user can create an account, it doesn’t tell you which account they can read or edit. That’s where row-level access like roles and public groups come in – if a user’s profile says they can read, create, edit accounts then their role and public groups tell you which accounts they can read and edit.
In this way, Roles/Public Groups and Profiles/Permission Sets work together to determine a user’s access to functionality and to records. If you have one but not the other, you won’t have access to a record – so if you have Read on Accounts on a Profile/Permission Set but not through Sharing with Roles/Public Groups/Ownership then you don’t have access and vice versa.
There are sometimes when one may override the other. For instance, you can have the Profile/Permission Set permission, Modify All Data or View All Data, in which case, we’ll ignore sharing and assume you have access to the record – but there are only a few exceptions to the rule that Profiles/Permission sets work hand-in-hand with Sharing Roles and Public Groups.
19. What are the benefits of the “One Trigger per Object” design pattern?
Answer: These are some basic benefits using ‘One trigger per Object’ design pattern
- Reusability: With your logic in a class, you can now re-use it outside of triggers, for example in a Visualforce page, test class, batch Apex, etc. No need to copy code!
- Simplicity: Every “trigger” gets reduced to just two lines of code in the master trigger. An object-oriented codebase is more organized, predictable, and modular too!
- Control your order of execution: In Apex, “the order of execution isn’t guaranteed for multiple triggers on the same object.” This pattern gives you total order control.
- The code in style!: You’re going to look like an Apex master using this pattern whether or not you take advantage of any of the benefits above. Plus, it’s a common interview question!
20. What is cross object formula creation?
Answer: It means creating a relationship between two fields from two different objects. For creating this object have to have lookup or mater relationship.