I thought a lot about whether I should make a post about common Salesforce Interview Questions. I’ve decided to go ahead and post anyway even though I share the same opinion as Steven Harod.
Job interviews are designed to evaluate for your knowledge and understand how you solve problems. You also get the chance to evaluate the company and see if it would meet your needs and expectations. In nearly every job interview I’ve ever had there’s been whiteboard problems or a paper test. With this being said, I believe developers need to avoid blindly memorizing answers and spewing them out during the interview.
Focus more on knowing why the answer is correct and how you can use it to build really good processes. If you really don’t understand the fundamentals you will eventually be caught and terminated by the employer. I have been diligently working on putting together a lot of posts about why to do things a certain way and expect to continue to post constantly.
Most of these questions can have varying answers and it’s really important to understand the context before you answer. Whenever possible, it usually makes sense to use declarative functionality over apex code although there’s times when it may not make sense. For example, a workflow is usually preferable to creating a trigger but there is a point where apex triggers can be more efficient than workflows. There are quite a few different bugs with process builder which would probably come up in interviews. For example, process builder doesn’t do very well with bulk updates but seems to work fine with bulk inserts.
What is an Object in Salesforce?
In Salesforce, an object is basically a representation of a database table. A record is simply another word for describing a database row.
Generally, in an job interview there will be a followup question asking what the difference is between Standard Objects and Custom Objects. Standard Objects are objects that are created by Salesforce during the setup of the org or during an update or installation process. A couple of standard objects are the Account, Case, Contact, Lead, and Opportunity.
Custom Objects are created by the Salesforce customer or by a Salesforce Partner. Usually custom objects are created to enhance standard functionality or provide some really extreme customizations.
What is a Lookup Relationship?
A lookup relationship links two objects together. In general, I recommend considering using the Lookup Relationship before you create a Master-Detail relationship.
Lookups are generally used to link two objects for loose coupling this means that the relationship isn’t mandatory and that the parent can be connected to many other child objects.
What is a “Master-Detail Relationship?”
A Master Detail Relationship is very similar to the Lookup Relationship but it’s a far more restrictive relationship because it enforces that there must be a parent and a child object. One of the key things to remember and point out is that if you delete the parent it will delete all of the children or detail records.
How can I create Many to Many relationships?
Using many-master detail relationships allows a many-to-many relationship to be created between any two objects. Many to many relationships allow for a record to relate to many other objects.
What is a Standard Controller?
A controller controls how the user interacts with a page and data. Salesforce provides standard controllers that work the exact same as standard Salesforce pages. Whenever possible it makes sense to use Standard Controllers because Salesforce is doing the heavy lifting and maintaining the code instead of having us do it.
Fields that are used on the page are automatically queried although there’s a way to query other fields in a controller extension.
What is a Controller Extension?
Controller Extensions provide a way to extend the functionality of a controller. Usually they’re used to override standard controllers or add some extra functionality.
One thing to keep in mind is that controller extensions don’t run in the same mode as standard controllers which means it’s possible that field level security and permissions may not apply.
What is a Wrapper Class?
A wrapper class is a custom apex class that contains different data types and properties. Usually they abstract away a list, set or map so that it can be easily used in visualforce to render a table or checkboxes.
What are some ways an Apex Class can be called?
Apex can be used in a lot of places. Apex can be used to parse emails, extend Salesforce dramatically, and be used to create custom REST APIs that can be called from outside of Salesforce.
What is a Validation Rule?
Validation Rules are a declarative mechanism for stopping bad data from being added to Salesforce whether it be through an insert or an update.
Make sure that you mention that Quick Create don’t fire validation rules when talking about validation rules.
What’s the difference between a Before and After Trigger?
Before triggers execute before the record has been committed to the database. After triggers execute after the data has been committed to the database. One of the key consequences of this is that fields like the Id, and formula fields may not be available during the trigger’s execution.
For a really more detailed description, I strong recommend reviewing my post about the difference between before and after triggers.
What is the difference between a trigger and a workflow?
Triggers are created programatically by using apex. Workflows are created declaratively through the Salesforce user interface. Usually it makes the most sense to try and make your changes in workflows instead of using triggers although there’s some cases where it can be better to use triggers.
What are some ways we can share a record in Salesforce?
There’s a bunch of different schemes for sharing records.
Managed Sharing is done automatically by the Force.com Platform based on role hierarchy, who owns the record, and sharing rules. Sharing rules are a way that Admins can give access to other users.
Manual sharing (User Managed Sharing) can be done to give a specific user access to records. Basically the record owner gives access to another user.
What is a permission set?
A permission set extends the users access without changing profiles by adding settings and permissions. A user can only have one profile, but can have lots of permission sets assigned to them.
What is the difference between a Role and a Profile?
Roles are what control access to records. User’s can only have one role, but where they are in the Role Hierarchy determines what they can see.
Profiles determine what the record can do basically what they can view or edit on the record.
If you are struggling with answering these questions or understanding why they are correct you probably aren’t really ready for a job with Salesfore yet. I put together a post with lots of different resources for learning Salesforce.
I also recommend asking some questions during the interview. Here’s a list of questions I usually ask in an interview.