Top 70+ Salesforce Interview Questions and Answers for Freshers & Experienced

As of Jan 2023, Salesforce is the world’s leading CRM service provider. They have more than 40% market share in the Cloud CRM space and dominates the overall CRM space with a market share of 19.7%. They were rated the world’s #1 CRM for two consecutive years and if the projected growth of Salesforce is anything to go by, the need for professionals with Salesforce training is only going to increase exponentially. This is where Salesforce enters the picture, and that is what has prompted me to write a blog on the most frequently asked Salesforce interview questions with answers.

Thanks to the knowledge and wisdom shared by some of our experts from the industry, I have shortlisted this definitive list of the Top 70+ Salesforce interview questions and answers which will help you prepare for the interview. Hopefully this helps you land a top-notch job in the domain of your passion. In case you attended a any interview recently, we urge you to post any question you have faced. Our experts will be happy to answer them for you.

This list of interview questions is divided into 9 sections, each for different aspects of Salesforce.

  1. Salesforce fundamentals
  2. Declarative features
  3. Audit & reporting features
  4. Data modelling and data management
  5. Logic & process automation
  6. Software testing
  7. Debug & deployment tools
  8. Integration features
  9. Programmatic features

A. Salesforce Fundamentals – Salesforce Basic Interview Questions for Freshers

1. What is Salesforce?

Salesforce is a cloud-based customer relationship management (CRM) platform that helps businesses manage their sales, marketing, and customer service activities. It provides a suite of tools and features that enable organizations to streamline their processes, automate tasks, and enhance collaboration among teams.

The core functionality of Salesforce revolves around managing customer information and interactions. It allows businesses to store and track customer data, such as contact details, communication history, and purchase preferences, in a central database. This information can be accessed and updated by different departments within the organization, enabling a holistic view of each customer.

2. What is a Custom Object in Salesforce?

In Salesforce, a custom object refers to an object that you create to store data that is specific to your organization and unique to your business processes. Salesforce comes with standard objects, such as Accounts, Contacts, Opportunities, and Cases, which are designed to cater to common business needs. However, custom objects allow you to extend the functionality of Salesforce and tailor it to your organization’s specific requirements.

3. What does a Custom Object permit the user to do?

A custom object in Salesforce permits users to:

  • Store specific data tailored to their organization’s needs.
  • Create custom fields to capture various types of information.
  • Design page layouts for a user-friendly interface.
  • Establish relationships with other objects for data organization.
  • Define validation rules to ensure data integrity.
  • Set up automation with triggers and workflows.

4. What is Self-Relationship in Salesforce?

In Salesforce, a self-relationship refers to creating a relationship between records of the same object. It means that each record in the object can be related to another record within the same object. Self-relationships are commonly used to represent hierarchical structures or to link records with other related records of the same object.

To create a self-relationship, you need to define a custom lookup or master-detail relationship field within the object itself that references other records of the same object. This custom field allows you to associate a record with another record within the same object

5. What can cause data loss in Salesforce?

Data loss in Salesforce can occur due to accidental deletion, data import errors, programming mistakes, integration issues, system bugs, user errors during data migration, API or bulk data operations, and misconfigured data retention policies. To prevent data loss, implement best practices, such as regular backups, access controls, validation rules, and testing before deployment

6. What is the difference between Triggers and Workflow?

Triggers and workflows are both automation features in Salesforce, but they serve different purposes and have distinct functionalities:

Triggers: Triggers are Apex code snippets that execute before or after specific database-related events (like insert, update, delete, etc.) occur on records in Salesforce.

Purpose: Triggers allow developers to define custom business logic and perform complex actions when specific events happen on records, such as updating related records, enforcing data validation, or sending email notifications.

Flexibility: Triggers offer high flexibility and customization capabilities since they are written in Apex, Salesforce’s programming language, and can handle complex processes.

Workflows: Workflows are declarative automation tools that let you define rules and actions to be performed when specific criteria are met on a record.

Purpose: Workflows are primarily used for simple automation tasks and are more user-friendly than triggers. They allow you to set up automated actions like field updates, email alerts, task creation, or outbound message delivery based on certain conditions.

Flexibility: While workflows provide automation without the need for coding, they have some limitations compared to triggers. They are ideal for straightforward actions but may not handle complex logic as effectively as triggers can.

7. What is the difference between Force.com and Salesforce.com?

Salesforce.com: Salesforce.com, also known as “Salesforce,” is the cloud-based customer relationship management (CRM) software provided by Salesforce. It is one of the leading CRM solutions globally and is used by businesses to manage their sales, marketing, customer service, and other related activities. Salesforce.com provides a user-friendly interface and a wide range of features to help organizations streamline their customer interactions, track leads, manage accounts, automate sales processes, and more.

Force.com: Force.com is the platform-as-a-service (PaaS) offering provided by Salesforce. It is the underlying development platform that powers Salesforce.com and allows developers to build custom applications and extend the functionality of Salesforce. With Force.com, developers can create and deploy custom business applications without the need to manage underlying infrastructure or worry about system maintenance. It offers tools and resources like Apex (a proprietary programming language), Visualforce (a markup language for building custom user interfaces), and various APIs for integration.

Check out Salesforce Masters Certification Program here!

8. Is there a limit for data.com records?

Yes, there are limits on the number of data.com records available for Salesforce users. Data.com provides access to a database of business-to-business (B2B) contact and company data that can be used for sales and marketing purposes.

The number of data.com records that a Salesforce organization can access depends on the type of Salesforce edition and the Data.com license level.

9. What is the difference between static and dynamic dashboards?

Static Dashboard:

A static dashboard is a type of dashboard where the components and data are fixed at the time of creation. In other words, the content of a static dashboard remains the same and does not change unless manually updated by the dashboard creator. The data displayed on a static dashboard is typically a snapshot of information taken at a specific point in time. Users viewing the dashboard see the same data each time they access it, regardless of any changes that may have occurred in the underlying records since the dashboard was last updated.

Static dashboards are useful when you want to provide a consistent view of data or share specific insights with others without the risk of the information changing dynamically.

Dynamic Dashboard:

A dynamic dashboard, on the other hand, is a type of dashboard that provides real-time or near real-time data updates. The components and data on a dynamic dashboard are not fixed but instead refresh automatically based on predefined intervals or user interactions. Dynamic dashboards allow users to see the most current data available, providing a more up-to-date view of the metrics and key performance indicators (KPIs).

10. What are some things that you can do to prevent governor limits?

Here are some key strategies to avoid hitting governor limits:

  • Bulkify Code: Write your Apex code to handle bulk data processing efficiently. Avoid using SOQL queries or DML statements inside loops. Instead, bulkify your code by processing records in collections, such as lists and sets.
  • Use Aggregate Queries: Utilize aggregate functions (e.g., COUNT, SUM, MAX, MIN) to perform calculations on large data sets, rather than using loops to calculate them manually.
  • Avoid Nested Loops: Minimize nested loops in your code, as they can quickly lead to hitting CPU limits. Aim to use single loops whenever possible.
  • Limit Query Results: Use LIMIT clauses in your SOQL queries to retrieve a specific number of records at a time. This can help manage heap size and avoid heap limits.
  • Query Selectively: Make use of indexes and filter your queries efficiently to reduce the number of records retrieved. Select only the fields you need, rather than querying all fields.

11. How can you edit apex classes in a production environment?

In Salesforce, avoid editing Apex classes directly in production. Instead, make changes in a sandbox, thoroughly test, and use deployment tools like Change Sets or Metadata API to move changes to production safely. This helps maintain stability and reduces the risk of introducing errors in the live environment.

12. What do you understand about workflow in Salesforce?

In Salesforce, a workflow is an automated process that allows you to define a series of actions and rules that trigger when certain conditions are met. Workflows are designed to streamline business processes, automate repetitive tasks, and ensure that specific actions are taken automatically in response to record changes.

13. What do you understand about workflow in Salesforce?

In Salesforce, a workflow is an automated process that allows you to define a series of actions and rules based on specific conditions. When these conditions are met, the workflow triggers predefined actions, such as field updates, email notifications, tasks, or outbound messages.

14. What are Permission sets?

In Salesforce, Permission Sets are a powerful way to grant additional permissions and access rights to users without changing their profiles. They allow administrators to extend user privileges beyond what is defined in their profiles, providing more flexibility in controlling user access to various Salesforce features and data.

15. What do you understand about validation rules in Salesforce?

In Salesforce, validation rules are used to enforce data quality and consistency by defining criteria that must be met when users create or update records. These rules help ensure that data entered into Salesforce adheres to specific business requirements and validation logic.

16. What do you understand about the term fiscal year or economical year in Salesforce?

In Salesforce, the term “fiscal year” or “financial year” refers to a defined 12-month period used for financial reporting and accounting purposes. The fiscal year does not always align with the calendar year (January to December) and can start on any date based on an organization’s accounting practices or fiscal cycle.

17. Explain the types of SOQL statements in Salesforce.

In Salesforce, SOQL (Salesforce Object Query Language) is used to retrieve data from the Salesforce database. There are several types of SOQL statements that developers and administrators can use to query records and related data:

Basic SOQL Queries: Basic SOQL queries are used to retrieve records from a single object based on specified criteria. The syntax is straightforward:

Relationship Queries: SOQL allows you to query records from related objects using relationship fields. For example, if you have a custom object related to an Account, you can query its fields along with related Account fields:

Aggregate Queries: Aggregate queries allow you to perform calculations on records. Common aggregate functions include COUNT, SUM, AVG, MIN, and MAX. These queries are useful for generating reports and summaries:

Nested Queries: SOQL supports nested queries, also known as subqueries. You can use subqueries to retrieve data based on results from another query. For example:

Parent-to-Child Queries: Parent-to-child queries allow you to traverse relationships in a hierarchical manner, starting from the parent object and querying its related child records. This is helpful when you need to retrieve all related child records for a specific parent:

Order By and Limit: SOQL allows you to use ORDER BY to sort query results and LIMIT to limit the number of records returned:

18. What is Salesforce Lightning?

Salesforce Lightning is a modern user interface framework and design system developed by Salesforce. It is designed to provide a more intuitive, responsive, and engaging user experience across various devices and platforms, including desktops, tablets, and mobile devices. Salesforce Lightning represents a significant upgrade from the classic Salesforce user interface and offers a range of enhanced features and functionalities.

19. How does Salesforce track sales?

Salesforce tracks sales in a variety of ways, including:

Opportunities: Opportunities are records of potential sales that are tracked in Salesforce. They include information about the customer, the product or service being sold, the expected close date, and the probability of closing the deal.

Activities: Activities are any tasks or interactions that are related to an opportunity, such as phone calls, emails, meetings, or tasks. Activities are tracked in Salesforce to help sales reps stay organized and track their progress on deals.

Reports and dashboards: Salesforce provides a variety of reports and dashboards that can be used to track sales performance. These reports can be customized to show information such as closed deals, open opportunities, and lead conversion rates.

Pipelines: Pipelines are visual representations of the sales process. They show the different stages that a deal goes through, from lead to closed won. Pipelines can be used to track the progress of deals and identify areas where sales reps need to focus their efforts.

Salesforce Analytics: Salesforce Analytics is a suite of tools that can be used to analyze sales data. These tools can be used to identify trends, patterns, and insights that can help sales reps improve their performance.

20. What is a static resource in Salesforce?

A static resource in Salesforce is a file that can be referenced in a Visualforce page. Static resources can include images, style sheets, JavaScript files, and other types of files. Static resources are stored in the Salesforce Content Delivery Network (CDN), so they are accessible to users from anywhere in the world.

Static resources are a great way to improve the performance of Visualforce pages. When you reference a static resource in a Visualforce page, the file is only downloaded once, when the page is first loaded. This can improve the performance of the page, especially for pages that contain large images or JavaScript files.

21. What are the 3 types of Object relations in Salesforce?

  • Lookup relationships: A lookup relationship is the most basic type of relationship. It creates a child-parent relationship between two objects. For example, an Account object can have a lookup relationship to a Contact object. This means that each Account record can have one or more related Contact records.
  • Master-detail relationships: A master-detail relationship is a more complex type of relationship. It creates a strong parent-child relationship between two objects. For example, a Product object can have a master-detail relationship to a Pricebook object. This means that each Product record must have one and only one related Pricebook record.
  • Many-to-many relationships: A many-to-many relationship is the most complex type of relationship. It allows you to create a relationship between two objects where each object can have multiple related records from the other object. For example, a User object can have a many-to-many relationship to a Group object. This means that each User can be a member of multiple Groups, and each Group can have multiple members.

22. What is an Audit trail?

In Salesforce, an audit trail refers to a feature that tracks and logs changes made to records and setup configuration within the platform. It provides a historical record of activities and modifications, allowing administrators and users to review and monitor changes over time. The audit trail helps ensure data integrity, compliance, and accountability within the Salesforce environment.

23. What is a wrapper class?

In Salesforce, a wrapper class is a custom Apex class that is used to encapsulate multiple data types or objects into a single object. It allows you to combine different types of data or objects into a unified structure, making it easier to work with and pass around in your Apex code.

24. What are some benefits of using Salesforce?

  • Streamlined sales processes and improved efficiency.
  • Centralized customer data for better relationship management.
  • Enhanced collaboration and teamwork.
  • Scalability and flexibility to adapt to business growth.
  • Data-driven decision making for informed choices.
  • Integration capabilities for seamless data flow.
  • Mobile access for productivity on the go.
  • Customization to align with specific business needs.
  • Strong security measures for data protection.
  • Supportive user community and comprehensive resources.

25. What is the junction object and what purpose does it serve?

A junction object is a custom object that serves as a bridge or connector between two related objects in a many-to-many relationship. It allows you to create a relationship between records from different objects, enabling more complex data modeling and data management.

Junction objects are widely used in Salesforce when dealing with complex relationships like many-to-many or when you need to store additional information specific to the relationship between two objects. They provide an elegant and flexible way to model these types of relationships, ensuring data accuracy and consistency within the Salesforce platform.

26. What are the different types of reports available in Salesforce?

  • Tabular Reports: Present data in a table format.
  • Summary Reports: Group data and display subtotals and grand totals.
  • Matrix Reports: Summarize data in a grid-like layout.
  • Joined Reports: Combine data from multiple sources into one report.
  • Cross-Summary Reports: Display summarized data in rows and columns.
  • Chart Reports: Visualize data in graphical formats.
  • Dashboard Reports: Consolidate multiple reports and charts in a single dashboard.
  • Historical Trend Reports: Analyze data over time to track changes and patterns.
  • Lightning Report Builder: Modern tool for creating custom reports with a user-friendly interface.

27. How is SaaS beneficial in Salesforce?

SaaS in Salesforce provides cost savings, easy accessibility, scalability, data security, continuous updates, seamless integration, customization options, collaboration features, and powerful analytics for businesses using the CRM platform

28. What can cause data loss?

Data loss in Salesforce can occur due to various reasons, including:

  1. Human Error: Accidental deletion, overwriting of data, or incorrect data updates by users can lead to data loss if proper backup and recovery mechanisms are not in place.
  2. System Issues: Technical problems or software glitches can cause data loss. This can include issues with data synchronization, data corruption, or software bugs that result in the loss or corruption of records.
  3. Data Migration: During data migration from external systems or during data imports, errors in data mapping, transformations, or validation processes can result in data loss or data integrity issues.
  4. Integration Errors: When integrating Salesforce with other systems or applications, issues such as data mapping errors, failed data transfers, or data mismatches can lead to data loss or inconsistencies.
  5. Security Breaches: Unauthorized access or data breaches can result in data loss or compromise. It is crucial to have robust security measures in place to protect data from external threats.

29. Can two users have the same profile? Can two profiles be assigned to the same user?

Profiles determine the level of access a user can have in a Salesforce org.

As far as the first part of the question is concerned, Yes. One profile can be assigned to any number of users. Take the example of a Sales or Service team in a company. The entire team will be assigned the same profile. The admin can create one profile: Sales Profile, which will have access to the Leads, Opportunities, Campaigns, Contacts and other objects deemed necessary by the company.

In this way, many users can be assigned the same profile. In case the team lead or manager need access to additional records/ objects then it can be done by assigning permission sets only for those users.

Answering the second part of the question, each user can only be assigned 1 profile.

30. What are Governor Limits in Salesforce?

In Salesforce, it is the Governor Limits which controls how much data or how many records you can store in the shared databases. Why? Because Salesforce is based on the concept of multi-tenant architecture. In simpler words, Salesforce uses a single database to store the data of multiple clients/ customers. The below image will help you relate to this concept.

To make sure no single client monopolizes the shared resources, Salesforce introduced the concept of Governor Limits which is strictly enforced by the Apex run-time engine.

Governor Limits are a Salesforce developer’s biggest challenge. That is because if the Apex code ever exceeds the limit, the expected governor issues a run-time exception that cannot be handled. Hence as a Salesforce developer, you have to be very careful while developing your application. To learn more about it, enroll for Salesforce Developer Certification today.

Different Governor Limits in Salesforce are:

  • Per-Transaction Apex Limits
  • Force.com Platform Apex Limits
  • Static Apex Limits
  • Size-Specific Apex Limits
  • Miscellaneous Apex Limits
  • Email Limits
  • Push Notification Limits

31. What is a sandbox org? What are the different types of sandboxes in Salesforce?

A sandbox is a copy of the production environment/ org, used for testing and development purposes. It’s useful because it allows development on Apex programming without disturbing the production environment.

When can you use it?
You can use it when you want to test a newly developed Force.com application or Visualforce page. You can develop and test it in the Sandbox org instead of doing it directly in production.

This way, you can develop the application without any hassle and then migrate the metadata and data (if applicable) to the production environment. Doing this in a non-production environment allows developers to freely test and experiment applications end to end.

Types of Sandboxes are:

  • Developer
  • Developer Pro
  • Partial Copy
  • Full

32. Can you edit an apex trigger/ apex class in production environment? Can you edit a Visualforce page in production environment?

No, it is not possible to edit apex classes and triggers directly in production environment.

It needs to be done first in Developer edition or testing org or in Sandbox org. Then, to deploy it in production, a user with Author Apex permission must deploy the triggers and classes using deployment tools.

However, Visualforce pages can be created and edited in both sandbox and in production.

Only if the page has to do something unique (different values), it would have to be developed via Sandbox.

33. What are the different data types that a standard field record name can have?

A standard field record name can have data type of either auto number or text field with a limit of 80 chars.

For generating auto numbers, the format needs to be specified while defining the field and after that for every record that is added, the number will get auto generated. For example:-
Sr No-{1}
Sr No-{2}
Sr No-{3}

34. Why are Visualforce pages served from a different domain?

Visualforce pages are served from a different domain to improve security standards and block cross site scripting. Take a look at the highlighted portion in the below Visualforce page:-

B. Salesforce Interview Questions and Answers on Declarative Features

35. What is WhoId and WhatId in activities?

WhoID refers to people. Typically: contacts or leads. Example: LeadID, ContactID

WhatID refers to objects. Example: AccountID, OpportunityID

36. What is the use of writing sharing rules? Can you use sharing rules to restrict data access?

Sharing rules are written to give edit access (public read and write) or public read only access to certain individuals in Salesforce org. A classic example is when:- only your managers or superiors need to be given extra credentials to your records in objects as compared to your peers.

By default, all users in your organization will have organization-wide-default sharing settings of either Public Read Only or Private.
To give access to more records, which users do not own, we write sharing rules.
Example: Sharing rules are used to extend sharing access to users in public groups or roles. Hence, sharing rules are not as strict as organization-wide default settings. They allow greater access for those users.

As far as the second part of the question is concerned, the answer is no. We cannot use sharing rules to restrict data access. It is only used for allowing greater access to records.

37. What are the different types of email templates that can be created in Salesforce?

The different types of Email templates are listed in the below table:-

TextAll users can create or change this template
HTML with letterheadOnly Administrators and users having “Edit HTML Templates” permissions can create this template based on a letterhead.
Custom HTMLAdministrators and users having “Edit HTML Templates” permissions can create this template without the need of a letterhead
VisualforceOnly administrators and developers can create this template. Advanced functionalities like merging data from multiple records is available only in this template

C. Salesforce Interview Questions and Answers on Audit & Reporting Features

38. What is a bucket field in reports?

A bucket field lets you group related records together by ranges and segments, without the use of complex formulas and custom fields. Bucketing can thus be used to groupfilter, or arrange report data. When you create a bucket field, you need to define multiple categories (buckets) that are used to group report values.

The advantage is that earlier, we had to create custom fields to group or segment certain data.

39. What are dynamic dashboards? Can dynamic dashboards be scheduled?

Before we understand dynamic dashboards, let us first understand static dashboards. Static dashboards are the basic dashboard types that will be visible to any user who has made a report out of his data. An example of this is what a Sales manager/ Marketing manager would be able to see on his Salesforce org. In other words, a normal dashboard shows data only from a single user’s perspective. Now comes the concept of dynamic dashboards.

Dynamic dashboards are used to display information which is tailored to a specific user. Let us consider the same example as above. In case the Sales manager wants to view the report generated specific to only one of his team members, then he can use dynamic dashboards.

You can use dynamic dashboards when you want to show user-specific data of a particular user, such as their personal quotas and sales, or number of case closures, or leads converted etc.
You can also use a normal/ static dashboard when you want to show regional or organization-wide data to a set of users, such as a particular region’s sales number, or a particular support team’s performance on case closures.

As far as the second part of the question is concerned, no we cannot schedule a dynamic dashboard. That is because whenever we open the dashboard, it will show the data generated in real-time.

40. What are the different types of reports available in Salesforce? Can we mass delete reports in Salesforce?

Salesforce Report Types

1. Tabular reportsSimple Excel type tables which provide a list of items with the grand total
2. Summary reportsSimilar to Tabular reports, but also have functionality of grouping rows, viewing subtotals & creating charts
3. Matrix reportsTwo-dimensional reports which allow you to group records both by row and column
4. Joined reportsMultiple blocks showing data from different reports based on same or different report types

Another important point to note here is that, only Summary reports and Matrix reports can be fed as data source for dashboards. Tabular and Joined reports cannot be used as data source for dashboards.

Can we mass delete reports in Salesforce? Of Course we can mass delete reports in Salesforce. The option to mass delete reports can be found under Data Management in Setup.

D. Salesforce Interview Questions on Data Modelling & Data Management

41. What are the different types of object relations in salesforce? How can you create them?

The questions list is incomplete without involving relationships between objects in Salesforce. Relationships in Salesforce can be used to establish links between two or more objects.

The different types of object relationships in Salesforce are:

  1. Master-Detail Relationship (1:n):- It is a parent-child relationship in which the master object controls the behavior of the dependent child object. It is a 1:n relationship, in which there can be only one parent, but many children.The main concept you need to be know is that, being the controlling object, the master field cannot be empty. If a record/ field in master object is deleted, the corresponding fields in the dependent object are also deleted. This is called a cascade delete. Dependent fields will inherit the owner, sharing and security settings from its master.You can define master-detail relationships between two custom objects, or between a custom object and standard object as long as the standard object is the master in the relationship.
  2. Lookup Relationship (1:n):-
    Lookup relationships are used when you want to create a link between two objects, but without the dependency on the parent object. Similar to Master-Detail relationship, you can think of this as a form of parent-child relationship where there is only one parent, but many children i.e. 1:n relationship.The difference here is that despite being controlling field, deleting a record will not result in automatic deletion of the lookup field in the child object. Thus the records in the child object will not be affected and there is no cascade delete here. Neither will the child fields inherit the owner, sharing or security settings of its parent.
  3. Junction Relationship (Many-To-Many):-
    This kind of a relationship can exist when there is a need to create two master-detail relationships. Two master-detail relationships can be created by linking 3 custom objects. Here, two objects will be master objects and the third object will be dependent on both the objects. In simpler words, it will be a child object for both the master objects.

42. What happens to detail record when a master record is deleted? What happens to child record when a parent record is deleted?

In a Master-Detail relationship, when a master record is deleted, the detail record is deleted automatically (Cascade delete).

In a Lookup relationship, even if the parent record is deleted, the child record will not be deleted.

43. Can you have a roll up summary field in case of Master-Detail relationship?

Yes. You can have a roll-up summary in case of a master-detail relationship. But not in case of a lookup relationship.

A roll-up summary field is used to display a value in a master record based on the values of a set of fields in a detail record. The detail record must be related to the master through a master-detail relationship.

There are 4 calculations that you can do using roll-up summary field. You can count the number of detail records related to a master record. Or, you can calculate the sum, minimum value, or maximum value of a field in the detail records.

44. Explain the term “Data Skew” in Salesforce.

Data skew” is a condition which you will encounter when working for a big client where there are over 10,000 records. When one single user owns that many records we call that condition ‘ownership data skew’.

When such users perform updates, performance issues will be encountered because of “data skew”. This happens when a single user/ members of a single role own most of the records for a particular object.

45. Explain skinny table. What are the considerations for Skinny Table?

In Salesforce, skinny tables are used to access frequently used fields and to avoid joins. This largely improves performance. Skinny tables are highly effective, so much so that even when the source tables are modified, skinny tables will be in sync with source tables.

Considerations for skinny tables:

  • Skinny tables can contain a maximum of 100 columns.
  • Skinny tables cannot contain fields from other objects.
  • For full sandboxes: Skinny tables are copied to your Full sandbox organizations, as of the Summer ’15 release.

46. Which fields are automatically Indexed in Salesforce?

Only the following fields are automatically indexed in Salesforce:

  • Primary keys (Id, Name and Owner fields).
  • Foreign keys (lookup or master-detail relationship fields).
  • Audit dates (such as SystemModStamp).
  • Custom fields marked as an External ID or a unique field.

47. How to handle comma within a field while uploading using Data Loader?

In a Data Loader .CSV, if there is a comma in field content, you will have to enclose the contents within double quotation marks: ” “.

E. Salesforce Interview Questions on Logic & Process Automation

48. For which criteria in workflow “time dependent workflow action” cannot be created?

Time dependent workflow action cannot be create for: “created, and every time it’s edited”.

49. What are the types of custom settings in Salesforce? What is the advantage of using custom settings?

There are two types of custom settings in Salesforce: List Custom Settings and Hierarchy Custom Settings.

List Custom Settings are a type of custom settings that provides a reusable set of static data that can be accessed across your organization irrespective of user/ profile.
Hierarchy Custom Settings are another type of custom settings that uses built-in hierarchical logic for “personalizing” settings for specific profiles or users.

The advantage of using custom settings is that it allows developers to create a custom set of access rules for various users and profiles.

50. How many active assignment rules can you have in a lead/ case?

Only one rule can be active at a time.

51. What are custom labels in Salesforce? What is the character limit of custom label?

Custom labels are custom text values that can be accessed from Apex classes or Visualforce pages. The values here can be translated into any language supported by Salesforce.
Their benefit is that they enable developers to create multilingual applications which automatically presents information in a user’s native language.

You can create up to 5,000 custom labels for your organization, and they can be up to 1,000 characters in length.

52. What is the difference between a Role and Profile in Salesforce?

As mentioned in one of the previous questions, a profile will ultimately control access to which records a user has in a Salesforce org. No user can work on the Salesforce org without being assigned a profile. The Profile is therefore mandatory for every user.

Role however is not mandatory for every user. The primary function of the Role/ Role hierarchy is that it allows higher level users in hierarchy get access to records owned by lower level users in the hierarchy. An example of that is Sales Managers getting access to records owned by Sales Reps while their peers do not get access to it.

53. What are the examples of non-deterministic Force.com formula fields?

Before I mention some of the examples, let me give you an introduction to deterministic and non-deterministic formula fields. Formula fields whose value will be static are referred to as deterministic fields. Whereas, formula fields whose value will be changed dynamically or whose values will have to be calculated on the fly, they are referred to as non-deterministic formula fields. A classic example of that is a formula returning the current date and time.

Some examples of non-deterministic fields in Force.com are:

  • Lookup fields
  • Formula fields whose reference spans over other entities
  • Fields having dynamic date functions like:- TODAY() or NOW()

F. Salesforce Testing Interview Questions

54. Why do we need to write test classes? How to identify if a class is a test class?

Software developers from around the world will unanimously agree that writing code in test classes makes debugging more efficient. Why? That is because test classes help in creating robust and error-free code be it Apex or any other programming language. Since Unit tests are powerful in their own right, Salesforce requires you to write test classes in Apex code.

Why are they so powerful? Because test classes and test methods verify whether a particular piece of code is working properly or not. If that piece of code fails, then developers/ testers can accurately locate the test class having the faulty bug.

Test classes can be determined easily because every test class will be annotated with @isTest keyword. In fact, if we do not annotate a test class with @isTest, then it cannot be defined as a test class. Similarly, any method within a class which has the keyword testMethod, is a test method.

55. What is minimum test coverage required for trigger to deploy?

In Salesforce, if you want to deploy your code to production, then you must make sure that at least 75% of your Apex code is covered by unit tests. And all these tests must complete successfully.

G. Salesforce Interview Questions and Answers on Debug & Deployment Tools

56. What are the different ways of deployment in Salesforce?

You can deploy code in Salesforce using:

  1. Change Sets
  2. Eclipse with Force.com IDE
  3. Force.com Migration Tool – ANT/Java based
  4. Salesforce Package

H. Salesforce Integration Interview Questions

57. What is an external ID in Salesforce? Which all field data types can be used as external IDs?

An external ID is a custom field which can be used as a unique identifier in a record. External IDs are mainly used while importing records/ data. When importing records, one among the many fields in those records need to be marked as an external ID (unique identifier).

An important point to note is that only custom fields can be used as External IDs. The fields that can be marked as external IDs are: TextNumberE-Mail and Auto-Number.

58. How many callouts to external service can be made in a single Apex transaction?

Governor limits will restrict a single Apex transaction to make a maximum of 100 callouts to an HTTP request or an API call.

59. How can you expose an Apex class as a REST WebService in Salesforce?

You can expose your Apex class and methods so that external applications can access your code and your application through the REST architecture. This is done by defining your Apex class with the @RestResource annotation to expose it as a REST resource. You can then use global classes and a WebService callback method.

Invoking a custom Apex REST Web service method always uses system context. Consequently, the current user’s credentials are not used, and any user who has access to these methods can use their full power, regardless of permissions, field-level security, or sharing rules.

Developers who expose methods using the Apex REST annotations should therefore take care that they are not inadvertently exposing any sensitive data. Look at the below piece of code for instance:-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
global class AccountPlan {
 webservice String area;
 webservice String region;
 //Define an object in apex that is exposed in apex web service
 global class Plan {
 webservice String name;
 webservice Integer planNumber;
 webservice Date planningPeriod;
 webservice Id planId;
 }
 webservice static Plan createAccountPlan(Plan vPlan) {
 //A plan maps to the Account object in salesforce.com.
 //So need to map the Plan class object to Account standard object
 Account acct = new Account();
 acct.Name = vPlan.name;
 acct.AccountNumber = String.valueOf(vPlan.planNumber);
 insert acct;
 vPlan.planId=acct.Id;
 return vPlan;
 } }

I. Programmatic Features – Advanced Salesforce Interview Questions and Answers for Experienced Professionals

60. What is the difference between a standard controller and a custom controller?

Standard controller in Apex, inherits all the standard object properties and standard button functionality directly. It contains the same functionality and logic that are used for standard Salesforce pages.

Custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Custom Controllers are associated with Visualforce pages through the controller attribute.

61. How can we implement pagination in Visualforce?

To control the number of records displayed on each page, we use pagination. By default, a list controller returns 20 records on the page. To customize it, we can use a controller extension to set the pageSize. Take a look at the sample code below:-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<apex:page standardController="Account" recordSetvar="accounts">
<apex:pageBlock title="Viewing Accounts">
<apex:form id="theForm">
<apex:pageBlockSection >
<apex:dataList var="a" value="{!accounts}" type="1">
{!a.name}
</apex:dataList>
</apex:pageBlockSection>
<apex:panelGrid columns="2">
<apex:commandLink action="{!previous}">Previous</apex:commandlink>
<apex:commandLink action="{!next}">Next</apex:commandlink>
</apex:panelGrid>
</apex:form>
</apex:pageBlock>
</apex:page>

62. How can you call a controller method from JavaScript?

To call a controller method (Apex function) from JavaScript, you need to use actionfunction.

Look at the below piece of code to understand how a controller method is called using actionfunction.

1
2
3
4
5
6
<script>
function JSmethodCallFromAnyAction()
{
callfromJS();
}
</apex:page>

63. How to get the UserID of all the currently logged in users using Apex code?

You can get the ID’s of all the currently logged in users by using this global function: UserInfo.getUserId().

64. How many records can a select query return? How many records can a SOSL query return?

The Governor Limits enforces the following:-

Maximum number of records that can be retrieved by SOQL command: 50,000.

Maximum number of records that can be retrieved by SOSL command: 2,000.

65. What is an attribute tag? What is the syntax for including them?

An attribute tag is a definition of an attribute of a custom component and it can only be a child of a component tag.

Note that you cannot define attributes with names like id or rendered. These attributes are automatically created for all custom component definitions. The below piece of code shows the syntax for including them:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<apex:component>
 <apex:attribute name="myValue" description="This is the value for the component." type="String" required="true"/>
 <apex:attribute name="borderColor" description="This is color for the border." type="String" required="true"/>

</p>
<p>
</p>
<p>
</p>
<p>
</p>
<h1 style="border:{!borderColor}">
<apex:outputText value="{!myValue}"/>
</h1>
<p>
</p>
<p>
</p>
<p>
</p>
<p>

</apex:component>

66. What are the three types of bindings used in Visualforce? What does each refer to?

There are three types of bindings used in Salesforce:-

  • Data bindings, which refer to the data set in the controller
  • Action bindings, which refer to action methods in the controller
  • Component bindings, which refer to other Visualforce components.

Data bindings and Action bindings are the most common and they will be used in every Visualforce page.

67. What are the different types of collections in Apex? What are maps in Apex?

Collections are the type of variables which can be used to store multiple number of records (data).

It is useful because Governor Limits restrict the number of records you can retrieve per transaction. Hence, collections can be used to store multiple records in a single variable defined as type collection and by retrieving data in the form of collections, Governor Limits will be in check. Collections are similar to how arrays work.

There are 3 collection types in Salesforce:

  • Lists
  • Maps
  • Sets

Maps are used to store data in the form of key-value pairs, where each unique key maps to a single value.
Syntax: Map<String, String> country_city = new Map<String, String>();

68. How can you embed a Visualflow in a Visualforce page?

  1. Find the flow’s unique name.
    1. From Setup, enter Flows in the Quick Find box, then select Flows.
    2. Click the name of the flow.
    3. Copy the unique name of the flow.
  2. From Setup, enter Visualforce Pages in the Quick Find box, then select Visualforce Pages.
  3. Define a new Visualforce page, or open an existing one.
  4. Add the <flow:interview> component somewhere between the <apex:page> tags.
  5. Set the name attribute to the unique name of the flow.

For example:

1
2
3
&lt;/apex:page&gt;
&lt;flow:interview name="flowuniquename"/&gt;
&lt;apex:page&gt;
  1. Click Save.
  2. Restrict which users can access the Visualforce page.
    1. Click Visualforce Pages.
    2. Click Security next to your Visualforce page.
    3. Move all the appropriate profiles from Available Profiles to Enabled Profiles by using the ‘add’ and ‘remove’ buttons.
    4. Click Save.
  3. Add the Visualforce page to your Force.com app by using a custom button, link, or Visualforce tab.

69. What is the use of “@future” annotation?

Future annotations are used to identify and execute methods asynchronously. If the method is annotated with “@future”, then it will be executed only when Salesforce has the available resources.

For example, you can use it while making an asynchronous web service callout to an external service. Whereas without using the annotation, the web service callout is made from the same thread that is executing the Apex code, and no additional processing will occur until that callout is complete (synchronous processing).

70. What are the different methods of batch Apex class?

Database.Batchable interface contains three methods that must be implemented:

  1. Start method:
    global (Database.QueryLocator | Iterable<sObject>) start(Database.BatchableContext bc) {}
  2. Execute method:
    global void execute(Database.BatchableContext BC, list<P>){}
  3. Finish method:
    global void finish(Database.BatchableContext BC){}

71. What is a Visualforce component?

A Visualforce Component is either a predefined component (standard from component library) or a custom component that determines the user interface behavior. For example, if you want to send the text captured from the Visualforce page to an object in Salesforce, then you need to make use of Visualforce components. Example: <apex:detail>

72. What is Trigger.new?

Triger.new is a command which returns the list of records that have been added recently to the sObjects. To be more precise, those records will be returned which are yet to be saved to the database. Note that this sObject list is only available in insert and update triggers, and the records can only be modified in before triggers.

But just for your information, Trigger.old returns a list of the old versions of the sObject records. Note that this sObject list is only available in update and delete triggers.

73. What all data types can a set store?

Sets can have any of the following data types:

  • Primitive types
  • Collections
  • sObjects
  • User-defined types
  • Built-in Apex types

74. What is an sObject type?

An sObject is any object that can be stored in the Force.com platform database. Apex allows the use of generic sObject abstract type to represent any object.

For example, Vehicle is a generic type and Car, Motor Bike all are concrete types of Vehicle.
In SFDC, sObject is generic and Account, Opportunity, CustomObject__c are its concrete type.

75. What is the difference between SOQL and SOSL?

The differences are mentioned in the table below:

SOQL vs SOSL

SOQL (Salesforce Object Query Language)SOSL (Salesforce Object Search Language)
Only one object can be searched at a timeMany objects can be searched at a time
Can query any type of fieldCan query only on email, text or phone
Can be used in classes and triggersCan be used in classes, but not triggers
DML Operation can be performed on query resultsDML Operation cannot be performed on search results
Returns recordsReturns fields

76. What is an Apex transaction?

An Apex transaction represents a set of operations that are executed as a single unit. The operations here include the DML operations which are responsible for querying records. All the DML operations in a transaction either complete successfully, or if an error occurs even in saving a single record, then the entire transaction is rolled back.

77. What is the difference between public and global class in Apex?

Global class is accessible across the Salesforce instance irrespective of namespaces.
Whereas, public classes are accessible only in the corresponding namespaces.

78. What are getter methods and setter methods?

Get (getter) method is used to pass values from the controller to the VF page.
Whereas, the set (setter) method is used to set the value back to controller variable.

I hope this set of interview questions will help you ace your job interview. As the next step for your career, check out the various certifications offered by Salesforce. It will also help you to understand the job roles and chalk out a career path for yourself. 

Also, check out this video on the Most Frequently Asked Salesforce Interview Questions, which was delivered by an industry expert. He has shared his opinion of Salesforce job interviews and industry demand. Do take a at it look and let us know if this helped in your interview preparation.