Scenario Based Salesforce Developer Interview Questions

Asking simple straightforward questions in Salesforce is history. Few years back Salesforce certified people were very less. Hence criteria was just to check whether that person know about Salesforce or not.

So questions used to be:
• What is Salesforce?
• What is account and contact?
• What is relationship between account contact?
• What is workflow?
• What is approval process?
etc.

If you notice above questions are crisp to the point. But now since in market there are many Salesforce certified people above style of interview doesn't work. One could easily memories these.

I too take interviews in my company and now style is different. Focus is more to ask scenario questions rather then what how etc.

Check Scenario Based Salesforce Interview Questions as one can have the theoretical knowledge. But the recruiters also checks for scenario based knowledge or Hands-On knowledge. Recruiters always ask tricky questions on the problems that one can face during implementation.

Only the person which has faced the problems while execution can only answer the questions.

 MIND IT !

Candidates have a significant tendency to learn from Salesforce exam dumps while preparing for Salesforce exams. This might gain you a certificate but fail you in the interview session.

• Make notes while preparing for the Salesforce exam. These can be consulted before the interview.

• Possess a thorough knowledge of the platform.

• Participate in the Salesforce Community and keep up with the newest developments.

• Even after obtaining the certificate, stay closely connected with hands-on experience through Trailblazer Superbadges and Super sets.

The interview questions get more complicated with the seniority of the role.

In this blog, I have tried to cover Scenario Based Salesforce Interview Questions that are often asked from a Salesforce developer in an interview.

In this competitive market, there is no dearth of Salesforce professionals. Here are the top scenario based questions for you to stand out during your next Salesforce Developer Interview.


 Interview Series

Hey friends, from this post I am starting Interview series for Salesforce Lightning which are very helpful in interview for experienced as well as fresher candidates.

I have tried to cover all the topics where as interviewers often try to cover the following topic during Salesforce Developer Interview.

Salesforce Admin Questions
Configuration Questions
Apex Questions
• Programmatic Features
• Integration Questions
• Miscellaneous Questions
• Testing Questions
• Debug And Deployment
• Conclusion
• Recommended Reading

Let start the interview series on Scenario Based Salesforce Questions (Between Interviewer & Interviewee).

Interview Series: Salesforce Scenario Based Interview Questions


Salesforce Admin Questions


Interviewer: Can two users have the same profile? Can two profiles be assigned to the same user?


Interviewee: 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.


Interviewer: Which fields are automatically Indexed in Salesforce?


Interviewee: 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.


Interviewer: Distinguish between Salesforce.com and Force.com.


Interviewee: Both are relatively the same but different in their functionality.


Salesforce.com helps build CRM-functionality-based applications, e.g., an iPhone ‘app’ that stores contact details, makes phone calls, and has all the other standard functions of a phone.

Force.com is used to customize a data model and a user interface, e.g., an iPhone OS environment that can build and run apps.


Interviewer: What is a Custom Object in Salesforce?


Interviewee: Custom Objects are nothing but database tables and are the objects created by you for the storage of information on a company or industry. While building a custom object, the Salesforce platform automatically builds things such as page layouts, etc for user interfaces.

For Example, Property objects that store information on homes sold by a real estate agent.


Interviewer: How does Salesforce deploy Sales Tracking?


Interviewee: Salesforce records data on details such as sales numbers, customer details, repeat customers & customers served and use these to create detailed reports, charts, and dashboards. This way it keeps a track of sales in your organization.


Interviewer: What is the limit of Data.com records which can be added to Salesforce?


Interviewee: In the Data.com user’s section, find your name to view your monthly limit. It will give details such as how many records are already added or exported for this month. The user goes to the Setup, enters the User in the Quick Find Box, and selects prospector users.


Interviewer: What is the difference between isNull and isBlank?


Interviewee: Use the ISBLANK() function for text fields. As text fields can never be NULL, even if nothing is provided as a value, ISNULL() function takes only an empty value. If ISNULL() is used with a text field then it returns false.


 MIND IT !

ISNULL(): Text fields are never null, so using ISNULL() with a text field always returns false. Empty date and date/time fields always return true when referenced in ISNULL() functions.

ISBLANK(): If you use ISBLANK() with a numeric field, the function only returns TRUE if the field has no value and is not configured to treat blank fields as zeroes.

For example, the formula field IF(ISNULL(new__c) 1, 0) is always zero regardless of the value in the New field. For text fields, use the ISBLANK () Salesforce function instead.


Interviewer: What is Profile? Mention the types of Profiles available in Salesforce.


Interviewee: A profile is similar to settings and permissions in Salesforce. It is used to perform different functions that are defined by users. It is another way to manage particular records.

There are two types of profiles:

• Standard profiles: Profiles created by Force.com
• Custom profiles: Profiles created by users

Salesforce standard profiles are:

• Standard User
• Solution Manager
• Marketing User
• Read-only
• System Administrator


Interviewer: What is the difference between Profile and Role?


Interviewee: The difference between Salesforce Profiles and Salesforce Roles are –


Profiles: Object and field-level access may be created using profiles, such as general permissions, tab level permissions, read & write permissions, and so on.

Profiles are mandatory for all users. Profile controls the access to which records a user has in the Salesforce org. It is not possible for the users to work in the Salesforce org, without being assigned to a profile.

Role: We may offer record-level access using roles, such as organization-wide defaults, Role hierarchy, sharing rules, and manual sharing. Simply put, record-level access is influenced by responsibilities.


Interviewer: What are the Permission Sets?


Interviewee: A permission set is a collection of settings and permissions for accessing various tools and functions in Salesforce. They are used for the extension of the user’s functional access, without any changes to the profiles. Users can have only one profile but multiple permission sets.

For Example, A set of users has the same profile called Sales Users. These users have the right to read, create and edit the leads. If some users need to transfer and delete leads, then a permission set is created here.


Interviewer: How to delete or freeze users in Salesforce.com?


Interviewee: Deleting a user is not possible in Salesforce.com, but we can deactivate the user by using the Freeze option.

To freeze a user, go to:

Setup --> Manage Users --> Users



Interviewer: Give one-word answers to the following questions:


a.) On the Visualforce page, how many field dependencies are used?
b.) Can two users have the same profile in Salesforce?
c.) Which field cannot be added as a custom index?
d.) Can we edit a formula field value in a record?
e.) Can we use sharing rules to restrict data access?

Interviewee: Answers to the following questions –


a.) 10 field dependencies
b.) Yes
c.) Formula field
d.) No
e.) No


 Interviewer: What is the use of SOQL? What are the differences between SOQL and SOSL?


 Interviewee: The full form of SOQL is Standard Object Query Language. SOQL evaluates to a single sObject and a list of many sObjects or an integer for count method queries. It is used to retrieve data from the Salesforce platform and resides inside Apex or Visualforce and returns a set of data.

Here is an example of a SOQL that is used for Get Number of Active Users In a Profile

SELECT COUNT(Id) FROM User WHERE IsActive = true AND Profile.Name = 'System Administrator'

The differences between SOQL and SOSL are given below.

SOQL SOSL

It is possible to search only one subject at a time.

Multiple objects can be searched here at a time.

Uses “SELECT” keyword for retrieval of records from the database.

Uses “FIND” keyword for retrieval of record from database.

It allows to search only one table.

It allows to search multiple tables.

It allows to perform DML operations on query results.

It is not possible to perform DML on search results.

This is used in a query ( ) call.

This is used in a search ()call in the API.

This is used in classes and triggers.

This cannot be used in triggers.

Returns records.

Returns fields.



 Interviewer: What is Data Skew in Salesforce?


 Interviewee: The full form of SOQL is Standard Object Query Language. SOQL evaluates a condition in an enterprise when you require to work with say 10,000 records.

A single user owns a huge number of records and we call that “ownership data skew” and it causes performance issues while updating in Salesforce.


 Interviewer: What is Data Import Wizard?


 Interviewee: With the Data Import Wizard, you can easily bring in data for various standard Salesforce objects such as accounts, contacts, leads, solutions, campaign members, and person accounts.

Additionally, you can import data for custom objects. It allows you to import a maximum of 50,000 records in one go. We cannot import Opportunity object records into Salesforce using Data Import Wizard.


 Interviewer: Can the Data Import Wizard can be used to delete records in Salesforce?


 Interviewee: No, The Data Import Wizard allows you to import, update, or upsert records, but it does not support record deletion.


 Interviewer: What is Data loader in Salesforce?


 Interviewee: The Salesforce data loader is a tool designed for efficiently importing and exporting data in bulk. It enables you to swiftly move large amounts of data into Salesforce and monitor the transfer progress.

It allows you to import a maximum of 50,00,000 records in one go.


 Interviewer: What is Salesforce Inspector?


 Interviewee: The Salesforce Inspector is a chrome extension used for resolving issues and debugging problems in a Salesforce environment.

It enables users to inspect specific records and their associated fields, leading to faster and more efficient issue identification and resolution.

It allows you to import a maximum of 50,00,000 records in one go.


 Interviewer: What is inline editing in Salesforce?


 Interviewee: Inline editing is a feature that lets you modify a field’s value without opening the record. You can edit a record from various places such as list view or report, without needing to navigate to the record page.


 Interviewer: What are Governor Limits? Give three examples.


 Interviewee: Salesforce works in a multi-tenant environment and imposes runtime limits to have the same performance within the database. These are imposed by the Apex runtime engine and ensure that the code does not misbehave.

This way the developer is forced to write efficient, scalable code.

Here are some examples of Governor Limits:

• The total number of SOQL queries issued has a synchronous limit of 100 and an asynchronous limit of 200.
• The total number of records retrieved for Database getQueryLocator must be limited to 10,000.
• The total number of records retrieved by a single SOSL query is 2000.



 Interviewer: What are Automation tools in Salesforce?


 Interviewee: Automation tools allow you to solve complex business requirement using low-code/no-code approach.

Example of automation tools are Workflows, Process Builders and Flows.


 Interviewer: What are flows in Salesforce? What are the Different Types of Flows?


 Interviewee: Salesforce Flow is an automation tool provided by Salesforce which can be used to perform various tasks like, Sending an Email, Posting a chatter, Sending custom Notifications &, etc. Flow is the most powerful automation tool provided by Salesforce. It can be trigger for record insert, update and record delete and it can be run for both after and before events.

There are 5 types of Salesforce Flows.

a.) Screen Flow
b.) Record-Triggered Flow
c.) Scheduled-Triggered Flow
d.) Platform Event Flow
e.) Auto launched Flow

1. Screen Flow

With Screen Flow you can create a custom UI (user interface) and guide users through a business process that can be launched from Lightning Pages, Experience Cloud (previously known as Community Cloud), quick actions and more.

2. Record-Triggered Flow

This Flow launches when is record is created, updated, or deleted. So far, we have used Apex triggers for these automations some of which can now be done using Flows.

3. Scheduled-Triggered Flow

This flow launches at the specified time and frequency for each record in a batch. Traditionally we have met this kind of requirement using Apex batch jobs.

4. Platform Event Flow

Launches when a platform event message is received. For example, you can pump the data from external system in Platform Events and then use Flows to split and save the records in different objects.

5. Auto launched Flow

Launches when invoked by Apex, Process Builder or even REST API

Salesforce Flow Components


 Interviewer: What is Flow Builder?


 Interviewee: Flow Builder is user interface used for building Flows in Salesforce. It consists of three main components namely Canvas, Toolbox and Button bar.


 Interviewer: Can you create new Process Builders in Salesforce?


 Interviewee: As per Summer’23 release, Salesforce has restricted creation of new Process Builders.


 Interviewer: What is Flow Interview?


Interviewee: A flow interview refers to a particular execution of a flow, which represents a complete run of that flow.


 Interviewer: How many maximum Flow versions can be there for each Flow?


Interviewee: 50, to create more flow versions, you need to delete the older versions.


 Interviewer: What is Flow template?


Interviewee: Flow template are pre-designed Flows that allow businesses to utilize these Flow structure and modify them according to their business requirements.

You can access these templates from Alt + Templates Tab


 Interviewer: What is the difference between a flow and a flow template?


Interviewee: A flow is a customized business solution created by a user. While a flow template is a pre-built, reusable flow provided by Salesforce, which can be customized to fit specific requirements.


 Interviewer: What are fault connector in Salesforce Flow?


Interviewee: In Salesforce flows, a fault connector is a connector that facilitates the management of errors and exceptions that might arise while executing the flow.


 Interviewer: What are Salesforce Flow best practices?


Interviewee: Following are the Salesforce best practices:


• Always test your Flows
• Consider Using Subflows
• Never Perform DML Statements In Loops
• Document your Flows
• Never Hard Code Ids
• Plan for fault handling


 Interviewer: Can we trigger time dependent flows in Salesforce?


Interviewee: Yes, scheduled Flows can be used to perform this task.



 Interviewer: What are email templates in Salesforce?


Interviewee: Email templates allow you to create dynamic email templates including customized header, Buttons, HTML Tags etc.


 Interviewer: What are different types of classic email templates in Salesforce?


Interviewee: Text, HTML with LetterHead, Custom and VisualForce.



 Interviewer: How to configure to receive error emails while debugging a Salesforce Flow?


Interviewee: Setup >> Process Automation >> Process Automation Settings >> Send Process or Flow Error Email to.



Interviewer: What is Object Relationship in Salesforce?


Interviewee: Salesforce Object relationships is nothing but a two way association between two Objects. One Object record information is linked in another object record. In Salesforce.com, Object Relationships is created between two Object. Here the custom field of an Object record contains a link in another object record. To build many custom object in Salesforce.com, relationships plays a major role.

Types of Salesforce Object Relationships.

The Salesforce object Relationships can be divided in to Two types. They are

1. One to Many (1:M) : One parent record is associated to many child records. Basically it forms the parent-child relationships. A parent object can have many child’s objects but a child object must have only one parent object.

    1. Master-Detail Relationship
    2. Lookup Relationship

2. Many to Many (M:M) One record of One object is linked to multiple records of another object and vice versa. In Salesforce.com, We create Many-to-Many Relationship by creating two master-details relationship with a common Junction Object.


Interviewer: What are some of the object relationship types available in Salesforce?


Interviewee: Here are the most used four types of relationships in Salesforce:


Master-Detail Relationship:It is a strongly coupled relationship. In this type of relationship, one object is the master, and another is the detail. The master object controls certain behaviours of the detail object, like who can view the detail’s data.

Lookup Relationship:A loosely coupled relationship essentially links two objects together to “lookup” one object from the related items on another object.

Below are the key differences between the two important and most used relationships:


Many-to-Many Relationships: Also known as Junction Objects, this relationship allows each record of a single object to be linked to multiple records of other objects and vice versa. They are created using a custom object and then relating two other objects via two master-detail relationships.

Hierarchical Relationships: This unique relationship can only be used on the user object and is designed to create a hierarchy of users. For example, it could be used to create a lookup field for the user object, which can be used to list the user’s expense approver.


Interviewer: What is different between Lookup and Master-Detail Relationship?


Interviewee: The differences between Look up and Master-Detail Relationship are given below.


Look up Master-Detail Relationship
The parent is not mandatory Parent is mandatory
Cascading delete is not possible Cascading delete is possible
Rollup Summary is not Possible Cascading delete is possible


Interviewer: What is Junction Object? What is it used for?


Interviewee: Junction objects are needed to build a many-to-many relationship among Salesforce objects.

For Example, In a typical recruitment scenario, there are possibilities of creating many positions for candidates and at the same time, a candidate can apply for many positions.

The third object required for creating a data model is termed a junction object and in this example, it can be cited as a “job application”. Here, you need to use a lookup field for both position and candidate object on the junction object – which is a job application.


Interviewer: What is Force.com Platform?


Interviewee:  Force.com is a Platform As A Service (PAAS) and simplifies the development and deployment of cloud-based applications and websites. The developers make use of the Integrated Development Environment or IDE to create apps and websites. Later, these are deployed in the multi-tenant servers of Force.com.


Interviewer:What is the difference between custom and standard reports?


Interviewers might include a few questions that ask you to explain the differences between two features in a Salesforce product. When answering a question that discusses the difference between two things, you can first describe the definition or highlight of each element and then explain how they vary. This approach demonstrates that you have thorough knowledge about the feature and understand its usage accurately.

Interviewee:  A report type in Salesforce is a template that makes reporting easier and straightforward. The report type determines the records and fields available for use and defines the relationships between a primary object and its related objects. In Salesforce, the two basic report types are standard and custom.

A standard report is the default type and Salesforce automatically generates it when you create objects and define the relationships between them.

A custom report is a user-created report and the admin can specify all the fields available to users while creating it. It also has the functionality to associate up to four objects. It is like instructing Salesforce that you need specific objects with pre-defined fields whenever you use the report.


Interviewer: What are the different types of reports that are available in Salesforce?


Interviewee:  The different types of Salesforce Reports include:


Tabular Report: Tabular Reports are the most simple type of Salesforce Report. It offers the fastest and simplest way to view your data. They have an ordered set of fields arranged in columns. Tabular Reports shouldn’t be used when you want to manipulate data in any way like present totals, calculations, or groups of data.

Matrix Report: Here the grouping is done based on both rows and columns.
They can be used to see different totals from your data and are effective when your goal is to display a huge amount of complex data.

Summary Report: Here the groups appear based on columns only.

With summary reports, you can group data by different accounts, and then do calculations to see totals, maximums, minimums, and averages. These reports allow you to easily see which accounts are bringing in the most revenue and which products or services they’re purchasing the most.

Joined Report: In this, two or more reports are joined in a single report.

Unlike other reports, a separate option exists to create a joined report. You can use different report types in each block which will give a 360-degree view of your data.


Interviewer: What is an Audit Trail?


Interviewee:  Administrators need to make changes in the organizational setup. Audit Trail history helps you to track the recent 20 changes that are made in setup, by multiple administrators.


Interviewer: What are Bucket Fields in Salesforce?


Interviewee:  The Bucket Field in Salesforce is a valuable feature that allows you to rapidly categorize values for a field in a report without having to create a custom formula field at the object level.
When you create a bucket field in Salesforce, you define multiple categories into groups depending on the record values, this bucket field will not affect other Salesforce reports.

Bucket fields in Salesforce are available in Tabular reports, Summary Reports and Matrix reports. Joined Reports does not support Bucket fields.


Interviewer: What Are Dashboards in Salesforce?


Interviewee:  A Salesforce Dashboard is a simple way to visualize key data from either one or multiple Salesforce reports, and can help to “identify trends, sort out quantities, and measure the impact of their activities”.

In another way : A dashboard is a graphical user interface which displays a summary of statistics and different data types in a single accessible location. Salesforce dashboards display reports, metrics and key performance indicators of the organisation with respect to the customer cycles.


Interviewer: What is Sandbox org in Salesforce? What are the different types of Sandbox in Salesforce?

Interviewee:  Sandboxes are for copies of the production organization. It is possible to make such multiple copies of the same environment that serve various purposes like development, testing, and training without any need for compromise of data in the production org.

As sandboxes are isolated from the production environment, operations performed in the sandbox have no impact on the production org.

There are four types of Salesforce Sandboxes as shown below:

• Developer Sandbox
• Developer Pro Sandbox
• Partial Copy Sandbox
• Full Sandbox

1. Developer Sandbox: A Developer Salesforce Sandbox provides an isolated environment to all applications and systems until they are ready to be shared. Further, it gives you 200 MB of storage for use. It is free of cost.

2. Developer Pro Sandbox: A Developer Pro Sandbox provides the same functionality as the Developer Sandbox, with addition to increasing file and data storage. This one gives 1 GB of data storage to use. It can handle more tasks mostly based on development and quality assurance for testing and training. Further, it is also free of cost.

3. Partial Copy Sandbox: In simpler words, Partial Copy Salesforce Sandbox is actually Developer Sandbox in addition to the data you will include in the sandbox template. Partial Copy sandboxes provide 5 GB of data storage and are not free of cost.

4. Full Sandbox: This sandbox provides an exact replica of your entire production organization along with all the data. It is fully intended to be used as a testing environment. Furthermore, it provides data storage equivalent to your production organization and is also not free of cost.


Interviewer: What are the options for deploying from Sandbox to Production org? What is an Outbound Change Set?

Interviewee:  Various methods are adopted for deploying a sandbox to production. The main method is using the Change Sets. A Change Set enables to creation and testing of a new object in the sandbox and then sending that to the production org. It contains information on the org and not on any data such as records.

The other methods to deploy sandbox to production org include Force.com IDE, unmanaged packages as well as ANT migration tools.

When sending customizations from the current org to another org the Outbound Change Set is used. Once received by the receiving org it is called Inbound Change Set.


Interviewer: What is Custom Label in Salesforce? How many Custom Labels can you define and of what size?

Interviewee:  Custom Labels enable developers to create multi-lingual applications. It automatically presents information as information or messages, by using the user’s native language. These are custom text values that are accessible from Apex classes, Lightning components, and Visualforce pages.

A minimum number of 5000 custom labels can be created for each organization. The size is about 1000 characters.


Interviewer: How to convert a 15-digit record ID to an 18-digit record and vice versa?


The interviewer might ask you questions like these that require you to perform specific tasks. These questions help the interviewer test your knowledge of using suitable Salesforce functions to complete these tasks. You can prepare for similar questions by revising essential Salesforce functions before the interview and updating your knowledge on them.

Interviewee: We can use the CASESAFEID() in the formula field to increase its value from 15 to 18 digits. To decrease the field size, remove the last three digits. Salesforce automatically truncates the field size from 18 to 15.



Configuration Questions



Interviewer: What are Sharing Rules?


Interviewee: Sharing rules in Salesforce are used to create automatic exceptions to the Organization-Wide Default settings for the users who do not own the record.

They should be applied to the objects whose org-wide defaults are set to Public Read-only or Private because sharing rules can only extend the access they cannot restrict the access provided by Organization-wide defaults.

For Example, An account sharing rule can be created based on an account owner or any other criteria such as account type.


Interviewer: What is the difference between Page Layout and Record Type?


Interviewee: Page Layouts control the layout and organization of fields, buttons, visualforce, custom links, s-controls, and related lists on any object record pages. They determine which all fields are visible, read-only, and mandatory. You can customize the content of record pages for users with a Page Layout.

Here is how you create a page layout:

Set Up ---> Customize ---> Account ----> Page Layout ---> Click on New Button

Record Types help to define different business processes, page layouts, and picklist values that are meant for different users. Here is how a new Record Type is created.

Set Up ---> Customize ---> Account ----> Record Type

For Example, A record type can be created with different picklist values for differentiating a sales deal with various service engagements.


Interviewer: What is the use of Custom Settings? What are the types of Custom Settings in Salesforce?

Interviewee: Custom Settings are like custom objects. They are generally used to create custom sets of data and can be associated with an organization, profile or a specific user.

The visibility of the custom setting can be controlled by marking it as public or protected. Custom Settings data set can be used in Formula fields, Validation rules, flows, Apex and SOAP API.

Types Of Custom Settings

In Salesforce we have two type of custom settings

1) List Custom Settings
2) Hierarchy Custom Settings


List Custom Settings Hierarchy Custom Settings
It provides a reusable set of static data which can be accessed across your organization. It uses a built-in hierarchical logic which lets you personalize settings for a specific user or a profile.
The data in List Custom Settings is directly visible to any user in the org. The data in Hierarchy Custom Settings checks the organization, profile and user settings for the current user and makes the data visible for them accordingly.


The main advantage of using Custom Settings is that the data is cached, which enables efficient access without the cost of repeated queries to the database. One doesn’t have to use SOQL queries which count against the governor limits.

 MIND IT !

Limits On Custom Settings

Here are a few limits that needs to be considered before using Custom Settings

• We can have up-to 300 fields per custom setting.
• Sharing a Custom Setting object or record is not possible.
• Since the Custom Settings are a type of custom object, each custom setting counts against the total number of custom objects available in your org.

• The total amount of cached data allowed for your org is the lesser of these two values:

  1. 10 MB
  2. 1 MB multiplied by the number of full featured user licenses in your org.

For example, if your org has three full licenses, you have 3 MB of custom setting storage. If your org has 20 org licenses, you have 10 MB of storage.


Interviewer: What are the differences between Workflow and Process Builder? What is the difference between Trigger and Process Builder?

Interviewee: Workflows and the Process Builder are types of declarative automation tools that can extend the functionality of the Salesforce platform. They have functionalities and features which enable them to automate business processes.

Workflows can only handle four actions such as email alerts, outbound messages, task creation, and field updates. However, Process Builder has a huge number of functionalities such as creating a record, posting to Chatter, launching a flow, submitting approvals, and quick actions.

If a process earlier had different workflows for different outcomes, then the same can be accomplished now with one process.

Moreover, only single criteria are evaluated by a Workflow, before triggering the automation. On the contrary, the Process Builder can evaluate multiple criteria and trigger different automation and all this depend on the criteria met.


Interviewer: What is the use of the Roll-up Summary Field and where can you use it?


Interviewee: Roll-up summary field can display a value in a master record based on the fields comprising the detail record. It creates values in related records such as those in the related lists. It can only be used in a master-detail relationship.

For Example, The sum of all invoices can be calculated for all the related custom object records in the accounts invoice-related list.


Interviewer: What is a Wrapper Class in Salesforce?


Interviewee: A Wrapper class is defined as a class and a data structure. It is an abstract data type which has its instances formed by a collection of objects.

The basic nature is that of a custom object and is defined by the Wrapper class properties. It allows records to be checked from a list and processed for a specific action.


Interviewer: What is the difference between WhoID and WhatID?


Interviewee: WhoID refers to people such as contact or leads. Whereas “What ID” refers only to objects.

In another way :

WhoID is used for people’s things and it uses Lead ID or contact ID in activities.

WhatID is used for things that are objects and it takes Account ID or an Opportunity ID for reference in activities.


Interviewer: Consider the scenario - Assume a manager who oversees a team of 20 users is leaving the organisation. What happens if I inactivate the manager?

This question tests your knowledge of role hierarchy, assignment rules and the approval processes. The interviewer provides such hypothetical situations to evaluate if you would be able to handle such similar situations later in the workplace. You can answer these questions by explaining your solution and why you feel it is the best possible option.

Interviewee: The best approach is to deactivate the manager's account and reassign the team to another manager. To prevent users from logging into the account during the reassignment, I suggest that we can freeze the team member's accounts temporarily by using the "freeze" button on the user record. Once the reassignment is over, we can deactivate the freeze button and continue with the new hierarchy.


Interviewer: Consider the scenario - What error does the system show when you create a new active escalation rule when another active rule is already in place?

The interviewer might try to confuse you by asking tricky questions like these. The question's wording might make you think that the Salesforce CRM shows an error message when you create a new escalation while another escalation already exists. But the actual response is that the CRM does not display an error message in this scenario.

Interviewee: No, there are no error messages. Instead, the Salesforce CRM marks the old escalation as inactive and the new escalation becomes the active rule. This is because the CRM permits only one escalation to be active simultaneously.


Interviewer: Consider the scenario - I want to delete 30,000 customer records but do not want anyone else to recover them. What can I do?

If you are applying for the role of a Salesforce administrator, you can expect the interviewer to ask such operation-based questions. These questions test your familiarity with the system and help the interviewer determine if you have the skills to solve Salesforce operational challenges for other users. You can explain these questions by specifying the command or procedure that solves the issue and how you use it.

Interviewee: Salesforce makes it easy to bulk delete records permanently using the hard delete option. The difference between delete and hard delete options is that the former sends the deleted records to the Salesforce recycle bin, where it remains for 15 days. The hard delete erases all records permanently from the Salesforce system with no way to recover it.


Apex Questions


Interviewer: What is Apex?


Interviewee: Apex is an object-oriented programming language that enables the developers to execute flow and transaction control statements, on Salesforce servers in association with a call to an API.

It adds business logic to system events such as related record objects, button clicks, and Visualforce pages – with Java-like syntax and acts as a stored procedure.


Interviewer: How Does Apex Work?


Interviewee: All Apex programs run entirely On-Demand on the Force.com Platform.


• First, the platform application server compiles the code into an abstract set of instructions that can be understood by the Apex runtime interpreters.

• The compiled code is stored in metadata.

When the end-users trigger the execution of Apex by clicking a button or the VisualForce page the application servers retrieve the compiled instructions from the metadata and send them to the runtime interpreter before returning the result.


Interviewer: What are the ways to call an Apex Class in Salesforce?


Interviewee: The various ways to call an Apex class in Salesforce are as follows:


• From another class
• From developer console
• From JavaScript links
• From home page components
• By using trigger
• From VisualForce page


Interviewer: What is an Apex Transaction?


Interviewee: An Apex transaction is a set of operations, that is executed as a single unit. These operations include DML operations that are responsible for querying records.

All the DML operations in a transaction get completed successfully or get completely rolled back if an error occurs even in saving a single record.


Interviewer: What are the types of Collections in Apex? Explain List and Set in Collections.


Interviewee: The types of collections in Apex are listed below:


• List
• Map
• Set

The list is a variable that has an ordered collection of elements and they are distinguished by their indices. The index is numeric and starts at zero. Given below is an example of declaring a list, with the list keyword followed by primitive data, sObjects, nested lists, map, or set types.

//Create an empty list of String
List<string>  myList = new List<string>();
//Create a nested list
List<List<Set<Integer>>> myNestedList  = new List<List<Set<Integer>>>();

A set is a collection of unordered elements of primitives or sObjects. No element can be retrieved by using an index as in the case of a list. While iterating the elements in a set, there should not be any reliance on the same order. Moreover, a set cannot contain duplicate elements.

Here is an example of a set created with hardcoded string values.

//Defines a new set with two elements
Set<String> set1 = new Set<String>{'Bengaluru', 'Kolkata'};


Interviewer: What are Maps in Apex?


Interviewee: 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> account = new Map<String, String>();


Interviewer: Is it possible to edit Apex Class/Trigger in the Production Environment?


Interviewee: No, it is not possible. We cannot directly edit the Apex Class/Trigger in the production environment. It can be done only in the Developer edition, sandbox org or the testing org.


Interviewer: When is it possible to use Apex over Workflow rules or Process Builder?


Interviewee: There are various reasons to adopt Apex over Workflow rules or Process Builder as shown below:

• Apex can be used in those cases where there are limitations for Workflow rules or Process Builder like putting information in external systems.

• Apex is more efficient while dealing with large sets of data as it has fewer limitations.


Interviewer: Is it possible to customize Apex and Visualforce directly from the Production Org?


Interviewee: It is not possible to customize Apex in the production org itself, however, it can be changed and deployed through a sandbox, and must meet test coverage. Visualforce, on the contrary, can be changed in the production org.


Interviewer: What is Apex Test Coverage?


Interviewee: The Apex testing framework generates code coverage numbers for the Apex classes and triggers, every time when one or more tests are run. Code Coverage denotes the number of executable lines of code in classes and triggers which is exercised by test methods.

Test methods are written and tested to generate the Code Coverage. It is calculated as a percentage of a covered line divided by a covered and uncovered line.

The minimum test coverage must be 75 % for deployment in the production org.


Interviewer: Is Test.startTest() and Test.stopTest() required in a test class?


Interviewee: Test.startTest() and Test.stopTest() are very useful when your test class hits Salesforce Governor Limits.

The code inside Test.startTest() and Test.stopTest() have new set of Salesforce Governor Limits. As a good practice, make sure initializing the variables, fetching records, creating and updating records are coded before Test.startTest() and Test.stopTest() and calling the controllers for code coverage is done inside Test.startTest() and Test.stopTest().

The code before Test.startTest() and after Test.stopTest() have new set of Salesforce Governor Limits and code between Test.startTest() and Test.stopTest() have new set of Salesforce Governor Limits.

Sample Test Class:

private class TestClass {
static testMethod void test() {
    /*
    Declare the variables, Fetch the required records, Create and update sample records
     */
          /*
              Test.startTest();
                      /*
                        Call the controller for code coverage
                        */
                        Test.stopTest();
                */
        }
}


Interviewer: What are assert statements and why are they used?


Interviewee: Assert statements are used to compare what the real value is and what the expected value is. There are 3 types of assert statements:

1. system.assertEquals(val1,val2)
2. system.assertNotEquals(val1,val2)
3. system.assertEquals(val1> val2)


Interviewer: What is seeAllData?


Interviewee: The test classes cannot recognize the data in the database by default and hence we need to mention the @isTest(seeAllData=true) so that it recognised the data in the database.


Interviewer: What all needs to be tested in Apex?


Interviewee: Salesforce recommends we test :


1. Single records
2. Bulk records
3. Positive scenarios
4. Negative scenarios
5. Restricted User


Interviewer: What is Apex Email Service?


Interviewee: When you want to process the content, attachments, and the headers of inbound emails then Apex Email Service is used. It is possible to create an email service that automatically creates contact records based on contact-related information in the messages.

Each of these email services is associated with a Salesforce generated email address, to which the users send messages for processing. It is also possible for multiple users to access a single email service.


Interviewer: Why do we use Batches?


Interviewee: If we have a use case to process millions of records, it would be difficult to do this manually as well as in a synchronous context (the time limit is 10 seconds) so we use batches to process bulk data or records together, with a new set of Governor limits per transaction.


Interviewer: What are the methods of Batch Apex Class?


Interviewee: It implements Database batchable interface with three methods as shown below.


a) Start: This is used at the beginning of the batch Apex job. It is used to collect the records or objects, to pass to the interface method execute. It returns the DatabaseQueryLocator object or an iterable that contains the records or objects passed into the job.

b) Execute: This is used for each batch of records that are passed to the method. This method is used for all the processing of data. This method takes the following:

• A reference to DatabaseBatchableContext Object.
• A list of sObject records.

c) Finish: This is called once all the batches are processed. This is used for sending confirmation emails or for executing post-processing operations. It uses one argument, which is the reference of the DatabaseBatchableContext object.


Here is an example of a Batch Apex Class:

global class batch implements Database.Batchable <sObject> { 
    
    global (Database.QueryLocator or  Iterable<sobject>)
        start(Database.BatchableContext bc) { 
            
            //query on object; 
            //return Database.getQueryLocator(query); 
            
        } 
    
    
    global void execute(Database.batchableContext bc, List <SObject> scope) { 
        
        //some processing. 
    } 
    
    global void finish(Database.BatchableContext bc) { 
        //job such as sending email or calling another batch class 
        
    } 
} 


 POINTS TO REMEMBER

 use Database.getQueryLocator when you are using simple query to create scope for object in batch job.
• use Iterable when you have complex criterion to process the record.
• If we use query locator object governor limit is bypassed.
• If we use Iterable governor limit is enforced.
• The order of execution is not guaranteed in execute method.
• If the batch is executed without the optional scope parameter and If in batch apex suppose we have 600 jobs and there are total 200 records to be proceeds in each transaction, so in total we have 3 transaction. If first transaction succeeds but second fails so in this case the records update done in first transaction are not rolled back.


 Limits in Batch Apex

Up to five queued or active batch jobs are allowed for Apex.

A maximum of 50 million records can be returned to the Database.QueryLocator object.

•If the start method returns a QueryLocator, the optional scope parameter of Database.executeBatch can have a maximum value of 2,000. If set to a higher value, Salesforce chunks the records returned by the QueryLocator into smaller batches of up to 2,000 records.

• If the start method returns an Iterable, the scope parameter value has no upper limit; however, if you use a very high number, you may run into other limits.

• The start, execute, and finish methods can implement up to 10 callouts each

• The maximum number of batch executions is 250,000 per 24 hours

 Only one batch Apex job’s start method can run at a time in an organization. Batch jobs that haven’t started yet remain in the queue until they’re started.

Share This Post:

About The Author

Hey, my name is Saurabh Samir and I am Salesforce Developer. I have been helping to elevate your Salesforce Knowledge. Do comment below if you have any questions or feedback's.