0% found this document useful (0 votes)
146 views17 pages

Salesforce Question & Answers

Profiles control object and system permissions for users, while roles help share records across an organization hierarchically. The three types of object relationships are lookup, master-detail, and junction objects for many-to-many relationships. SOQL is used to query Salesforce data, similar to SQL. Programmatic development uses code like Apex and Visualforce, while declarative uses clicks instead of code through tools like Process Builder and Flow.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views17 pages

Salesforce Question & Answers

Profiles control object and system permissions for users, while roles help share records across an organization hierarchically. The three types of object relationships are lookup, master-detail, and junction objects for many-to-many relationships. SOQL is used to query Salesforce data, similar to SQL. Programmatic development uses code like Apex and Visualforce, while declarative uses clicks instead of code through tools like Process Builder and Flow.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

General Questions

1. What is the difference between a role and a profile?

Profiles & Roles are both features that can be added to a user record in
Salesforce. Roles are optionally added while Profiles are a basic requirement
of setting up a user.
Profiles help to control object privileges such as CRED (Create, Read, Edit,
Delete). They also contain system permissions that a user can carry out such
as exporting data.

Roles on the other hand help with sharing records across an organisation.
They work in a hierarchical fashion, giving users access to records that are
owned by people lower down in the hierarchy.

2. Name three types of object relationships available in Salesforce?

There are three main relationship types in Salesforce…


 A lookup relationship can be used to link two objects together. It is the
most basic type of relationship that creates a child-parent relationship
between two objects.
 A master-detail relationship can also be used to link two objects together.
A master-detail relationship creates a tight relationship between the
parent and the child. The child record inherits the security of the parent,
and if the parent is deleted, all associated child records will also be
deleted. Master-detail relationships created some extra functionality such
as roll-up summary fields that allow you to calculate data on the parent
from the children.
 A many-to-many relationship (Also referred to as a junction object), allows
you to create a relationship between two objects that need to model a
many-to-many relationship. These are created with an object that has two
master-detail relationships to two parent objects.

3. What is SOQL used for?

SOQL stands for Salesforce Object Query Language. It is very similar to the


widely used language SQL (Structured Query Language), to query databases.
SOQL is specifically designed for Salesforce data and is used to query the
Salesforce platform to retrieve data. SOQL is used within Apex & Visualforce
to return sets of data.
4. What are the differences between Programmatic & Declarative
development?
Programmatic refers to development where a developer is writing code to
achieve a task. This could include, but is not limited to, Apex, Visualforce &
Lightning Web Components.

Declarative refers to “clicks not code” development, where individuals can


build UI’s and automation using tools such as Process Builder & Flow.
5. What options are available to you for deploying from Sandbox to
Production?

There are various ways to deploy from Sandbox to Production. The main way
is to use a Salesforce feature called Change Sets. These allow you to
package up components and then deploying them to another Salesforce Org.
You can also use the ANT Migration Tool.
However, it is also good to be aware of the current Salesforce DevOps trend
that is happening. There are a lot of Apps that make deploying changes to
Salesforce a lot easier than current available options.
6. How do Salesforce Releases work?

Salesforce has three releases a year that are named after the seasons, these
include Spring, Summer & Winter. These releases contain a huge amount of
new functionality across all Salesforce products, including changes to
development languages.

Salesforce announce releases months in advance, as well as provide a


chance to test new changes in a sandbox before the release date.

Apex Questions

7. What is Apex?

Apex is a strongly typed, object-oriented programming language that allows


developers to extend the Salesforce platform by writing their own business
logic into the platform. Apex looks similar to Java and can be launched
through a variety of user-initiated events such as record updates, button
clicks, triggers on objects, or external web service requests.
8.Can you customize Apex in a production org?

Apex cannot be customized in a production Org, it must be changed and


deployed through a sandbox and meet test coverage requirements.
9. What are the two options for when Apex Triggers can run?

Apex Triggers can either run before a record has been saved of after. A
“before” operation is usually used to verify information that is going to be
inserted, and an “after” trigger is used to access data that has previously
been entered by a user or system.
10. When should Apex be used over Workflow rules or Process Builder?

There are many reasons why you should use Apex over declarative
automation options, here are a couple of common answers…

 Workflow rules and Process Builder operations sometimes have feature


limitations that can be overcome with Apex. For example, pulling
information from an external system.
 When dealing with certain or large sets of data, Apex can be more efficient
than declarative options due to less limitations.

11. What are Governor Limits? Can you name 3 examples?

Salesforce runs on a multitenant environment which means resources


(Storage, CPU, Memory) are shared with other companies on the Salesforce
platform. This means limits must be in place to ensure that all companies
using the Salesforce architecture abide by certain rules and don’t let their
code or processes monopolize shared resources. A few examples of
Governor Limits are:
 Total number of records retrieved by a SOQL query – 50,000
 Total number of SOQL queries issued – 100 (Synchronous) 200
(Asynchronous)
 Total number of DML statements issued – 150
 Total number of callouts (HTTP requests or Web services calls) in a
transaction – 100
 Maximum CPU time on the Salesforce servers – 10,000ms (Synchronous)
60,000ms (Asynchronous)

12. What is Apex test coverage? What’s the minimum test coverage required
to deploy?

To ensure that your code meets certain standards, Apex Code


coverage shows you how many executable lines of code in your classes and
triggers have been exercised by test methods. Code coverage percentage is
a calculation of the number of covered lines divided by the sum of the
number of covered lines and uncovered lines.
The minimum test coverage required to deploy to production is 75%

13. What are some Apex best practices?

 Bulkify your code


 Avoid SOQL Queries or DML statements inside FOR Loops
 Avoid Hardcoding IDs
 Use of the Limits Apex Methods to Avoid Hitting Governor Limits
 Querying Large Data Sets
 See full list…

14. What is an Apex Email Service?

You can use email services to process the contents, headers, and


attachments of inbound emails. For example, you can create an email
service that automatically creates contact records based on contact
information in messages.
15. What are the different type of Collections you can have in Apex?

There are three main types of


 Lists – A list is an ordered collection of elements that are distinguished by
their indices. List elements can be of any data type—primitive types,
collections, sObjects, user-defined types, and built-in Apex types.

 Sets – A set is an unordered collection of elements that do not contain any
duplicates. Set elements can be of any data type—primitive types,
collections, sObjects, user-defined types, and built-in Apex types.
 Maps – A map is a collection of key-value pairs where each unique key
maps to a single value. Keys and values can be any data type—primitive
types, collections, sObjects, user-defined types, and built-in Apex User
Interface Questions

16. What is Visualforce?

Visualforce is the component-based user interface framework for Salesforce.


The framework includes a tag-based markup language, similar to HTML. Each
Visualforce tag corresponds to a coarse or fine-grained user interface
component, such as a section of a page, or a field.
Visualforce is a language that was built for the Salesforce Classic interface.

17. What is a Lightning Component?

The Lightning Component framework is a UI framework for developing


dynamic web apps for Salesforce Lightning. This is also referred to as the
original Aura Components model.
18. What is the difference between Lightning Web Components & Lightning
Components
Lightning Components are a user interface framework that is used to create
applications for desktop and mobile technologies on Salesforce.

Lightning Web Components were created to make it easier for those


unfamiliar with the complexity of Salesforce, to build on the platform. They
use a standardized-based architecture to provide better access to
developers.

Read More: Lightning Web Components Vs Lightning Components


19. What is the Lightning Message Service (LMS)?

The Lightning Message Service is a unique Salesforce feature that enables


communication between Visualforce, Aura, and Lightning Web Components
on the same Lightning Page. It’s worth noting that LMS is available in
Lightning Experience only.

Configuration Questions

20. What is Salesforce Flow?

Salesforce Flow is the most powerful declarative automation tool that lives
in Salesforce. If Workflow Rules or Process Builder reach certain limitations,
then Flow is an alterative to Apex code to build your automation solution.
You can display data to your users with screen elements, create branches
and loop over datasets.

21. How are sharing rules used in Salesforce?

Sharing rules can be set up in order to extend sharing and to grant users


access to a set of records depending on a defined criteria.
A sharing rule can be set up to extend sharing to public groups, roles, or
territories, depending on either the owner of a record or a field value. You
can either assign Read-Only access to these users or Read/Write access.

22. Can you explain the use of custom settings?

Custom settings are similar to custom objects and enable Developers or


Admins to create custom sets of data, as well as create and associate
custom data for an organization, profile, or specific user. You can use
custom settings to store a variety of information that can be accessed easily
by other Salesforce tools.
23. Explain the use of a roll-up summary field and where it can be used
Roll-up summary fields can be used to calculate information based on a
parent records child records. While a formula field can calculate information
within a single record, roll-up summary fields can calculate data from a set of
child records.

For example, a roll-up summary field could be used to calculate the total
value of all closed-won opportunities on an account. Roll-up summary fields
can only be used on a master-detail relationship.

24. What’s the difference between Record Types & Page Layouts

Whilst a page layout is used to define which fields, sections and related lists
are displayed to a user, a record type can extend this by defining different
business processes.

Read more: When to use Record Types Vs Page Layouts?

Integration Questions

25. Explain the use of an Outbound Message?

An outbound message is one automation function that can fire from a


workflow rule. They can send a message to external web services which can
contain field values, this can subsequently kick off additional processes in
external systems.
26. What is OAuth?

OAuth is an open standard for access delegation, commonly used as a way to


grant websites or applications access to their information on other websites,
but without giving them the passwords.
27. What is a Connected App?

A connected app integrates an application with Salesforce using APIs.


Connected apps use standard SAML and OAuth protocols to authenticate,
provide single sign-on, and provide tokens for use with Salesforce APIs.
In addition to standard OAuth capabilities, connected apps allow Salesforce
Admins to set various security policies and have explicit control over who
can use the corresponding apps.

28. Can you give an example of a Salesforce API and it’s usage?

Salesforce has a variety of API’s that let you interact with the system in
different ways..
REST – The REST API lets you integrate with Salesforce applications using
simple HTTP methods in either XML or JSON formats, making this an ideal
API for developing mobile applications or external clients.
Bulk – The Bulk API provides a programmatic access that lets you quickly
load data into your Salesforce organisation.
Streaming – The Streaming API can be used to receive notifications for
changes to Salesforce data that match a SOQL query you define.
Streaming API is useful when you want notifications to be pushed from the
server to the client based on criteria that you define.
29. What are External ID fields used for?

Certain fields can be defined as an external ID on an object. These can be


used in order to match up data from external systems with a unique
reference ID.
For example, if you need to match up data from an external accounting
system to the Accounts in Salesforce, you can use an external ID field to
reference the Accounting system’s unique ID instead of the Salesforce ID.

30. What is a use case for Salesforce Connect?

Salesforce Connect is a product that utilises external objects. External


objects allow you to integrate information into Salesforce in real-time, but
without actually utilising Salesforce storage limits.
An example of using Salesforce connect could be to integrate a large
database that houses transaction history against an account. This history
would be viewable and reportable in Salesforce, but without utilizing a large
amount of storage it would take to the house.
The Lightning Frameworks

1. What are the different programming models available for Lightning components?

There are 2 different programming models available for Lightning components. The first
is utilising the Aura framework to build out Aura components, the second is utilising the
newer Lightning Web Components (LWC) framework.

2. Why would you choose one programming model over the other?

Lightning Web Components should be the go-to approach for development due its
increased performance, ease of development and alignment with modern web standards.
However, there are some scenarios where Aura components are still required, as of
Summer ’21, these include building community templates and URL accessible
components, although LWC is quickly reaching feature parity.

3. How can we develop these components/what tools must we use?

Aura components can be developed directly in Salesforce using the developer console,
although third party IDEs (such as VSCode using SFDX) greatly improve developer
efficiency.

LWCs can only be developed using third party tools, which Salesforce recommends
VSCode and their extension pack.

4. How do the two programming models coexist?

Aura components can contain and utilise LWCs, including communicating with them via
events and component methods. However, the opposite is not true, an LWC cannot be
composed of Aura components, and they can only ever be its parent.

Code can also be shared between Aura and LWC components using an ES Module.

5. Where can we use Lightning components?

Lightning components can be used in a myriad of places, from drag and drop
components making up Lightning App Builder pages, to quick actions launched via
buttons on record detail pages. Components can also be exposed as tabs or URL
addressable for extra customisation.

Alongside the most common places mentioned above, there are some more niche places
Lightning components can find themselves, including:

 The Utility Bar


 Outlook and Gmail integrations
 Flows
 Visualforce pages
 External web pages
 Pre-chat snap-ins
Development Basics

6. What data types can we use within Lightning components?

Within Aura components we can use any of the basic data types, e.g. String, Boolean,
Date, Object etc and arrays of those datatypes. We can also define Aura attributes to
hold SObjects and move advanced datatypes such as functions, Apex defined datatypes
and we can define an attribute which can store other components.

In LWC, things are a lot more straightforward, since we do not need to define data types
on our attributes. This means that an attribute of an LWC can hold any JavaScript data
type – for example, we can hold all the standard data types, functions, HTML Nodes,
Promises and anything else that we may require.

7. What does the “this” keyword signify?

The “this” keyword can be found in both Aura and LWC, and their uses are quite similar.
Within LWC, the keyword can be used to access any component property or method –
since “this” points to calling context of the current code – which in most cases will be
from within the LWC.

In Aura however, the “this” keyword does not point to the component context, instead
we use the keyword from within our helper to reference other helper methods – this
works for the same reason as in LWC, since the calling context is our helper.

8. How can we express data into our HTML markup?

If we wish to express data within our HTML markup we need to use bind expressions.
The syntax differs between LWC, as do the capabilities.

In Aura we use can use one of two syntaxes, “{!v.value}” and “{#v.value}”. The first
enables two way data-binding (i.e. if you update it in one location, the other is also
updated) and the second is for one way binding.
In LWC, we have a single syntax to follow, simply by using “{value}”.

Alongside simply displaying pieces of data, we can also use conditionals and iterations
to manipulate the final markup. For simple “if” logic we can use “aura:if” in Aura and
“if:true”/“if:false” in LWC. For displaying arrays, we can use “aura:iteration” in Aura or
“for:each” in LWC, both of which work similarly by taking a piece of markup contained
within them and repeating it once for each item in the array.

9. How can we make our components admin configurable?

Both Aura components and LWCs can expose component properties into the Lightning
App Builder and Experience builder screens for further customisation by admins as they
see fit. We can also further limit where our components appear, preventing record-based
components from appearing on the incorrect object pages.

For Aura components we have a design resource file, which is where we define these.
We do so by specifying a “design:attribute” for each “aura:attribute” we wish to be
customised. We can also use “sfdc:objects” to limit the objects which the component
can be used on.

For LWC, we define our customisable properties from within the “.js-meta.xml” file which
is found inside all LWC component folders. We do this by defining “property” tags within
“targetConfigs” tags. LWC offers us far more flexibility than Aura does, allowing us to
define individual properties to be exposed based on the target context (i.e. record page
vs app builder page). Also, as within Aura, we can define which objects the component
should be limited to using “objects” tag.
10. How can we reuse code between our components?

To share code between Aura components, we create a service component. This is an


Aura component which uses “aura:method” to expose the pieces of code which are to be
shared. This component can then be included in other components and the shared
pieces of code called.

For LWC, the process is simpler, we can create EcmaScript Modules. These are
essentially JavaScript files which use the “export” keyword to export specific functions
or variables we have defined. These can then be imported in the same manner we import
Salesforce modules and freely used by our component.

User interaction and Events

11. How can we respond to user interactions?

Regardless of the framework used the answer remains the same, events. However, how
we define how to handle these events differs slightly by framework, but both are required
to define event handlers.

In Aura, we define handler code within our component’s controller. We can then tell our
component to listen to and then run our code when the events are fired in several
different ways. The simplest is to add an inline event handler on to the component that
fires it. The second way is to add an “aura:handler” tag. Both expect to be pointed
towards an action in the controller which handles the event.

Handling events in LWC is a much simpler affair than within Aura components since the
events are standard JavaScript events. We can either use inline event handlers on the
elements which fire it (or possibly even its ancestors if more appropriate!) or add event
handlers to our component dynamically through JavaScript.
12. What are the different phases of events?

Events have two phases, Bubbling and Capture. The bubbling phase is where the event
travels up the DOM to the very top, notifying event listeners on the way. This means the
first event handlers to run are those on the innermost elements (e.g. closest ancestors).
With capturing, the inverse is true, the event travels down from the top of the DOM,
calling the outermost event handlers first.

By default, events fired by Lightning components bubble up and are only handled by its
parent component, regardless of the phase.

Aura Application events also have a third phase, called the Default phase. In this phase
the event handlers are called non-deterministically.

13. How can we configure event propagation?

When declaring events in LWC, we can provide additional parameters in the constructor
of the CustomEvent to customise its behaviour. There are two parameters we can define
which change the behaviour of the event, these are “bubbles” and “composed”. As the
name suggests, bubbles allows the event to follow the standard bubbling behaviour and
travel up through the DOM, by default in LWC this value is false. Composed, on the other
hand, states that the event may pass through the shadow boundary and traverse the
entire DOM tree up to the root, by default this is also false and only has an effect if
bubbles is also set to true.
In Aura, we don’t explicitly define the event propagation behaviour, instead we can
specify the phase to handle on the event handler instead.

14. How can we manage our events to improve the User Experience?

In situations where an event can be frequently fired based on a user interaction, it’s
important we handle those events in a specific way so as to not cause a detrimental
impact to the user’s experience. A good example for this is a search bar which filters a
list when a user types into it, if we were handling the ‘onchange’ event, we would end up
filtering after every keypress and this would cause the search to appear sluggish to the
user. Instead what we want to do is set a timeout after every keypress, if the user
continues to type within a small time frame (say 500ms), we simply cancel the previous
timeout and start a new one. Now we only take the performance hit when we know the
user has done something valid and the filtering appears smooth. This technique is called
debouncing.

Component Styling

15. What is SLDS?

Salesforce Lightning Design System, or SLDS for short, is the framework behind the look
and feel of Salesforce Lightning. It includes design guidelines for how components
should work from a user experience point of view alongside HTML blueprints for
components (including some that don’t exist as base lightning components). The most
frequently used part of it, however, is the style sheets it provides which allow us to easily
implement consistent styles within components.

16. How can we apply custom styles?

When the style classes provided by SLDS don’t meet our requirements, we are still able
to provide our own styles to achieve what we need in both Aura and LWC. The process is
pretty similar in both frameworks: we create a CSS file which matches the name of the
component in its folder and place our styles there. In LWC, the styles of our components
are completely encapsulated and don’t overflow into other components. In Aura we
prefix all our styles with ‘.THIS’, but our styles can affect child components.
17. What is Flexbox and Grid in CSS?

Flexbox and Grid are two similar CSS layout modules, both of which can be used to build
components with complex layouts and mobile responsiveness. We can define an element
to be a container of a grid or a flexbox which allows fine control over the sizes and
behaviours of its child elements. For the most part we can simply use the ‘lightning-
layout’ base component to define a flexbox and then ‘lightning-layout-item’ to define its
flexible children. For more complex positions we would want to define the classes
ourselves and use a grid rather than a flexbox for a 2-dimensional layout.
18. How can we share styles between components?

CSS styles can be shared via static resources between both Aura and LWC, with
components requiring the styles simply importing them with the Platform Resource
Loader (in LWC) or ‘ltng:require’ (in Aura).
For LWCs, we can improve on this by instead using CSS modules. These are simply an
LWC component which only includes a CSS file. This can then be imported into another
component’s CSS file by using ‘@import c/myCssComponentName’.

The Wire Service and Lightning Data Service

19. What is the wire service?

The wire service is a data provisioning service which streams new data as it becomes
available. It supports reactive variables, allowing new data to be provisioned as the
context changes. The source of the data can either be from a Salesforce module, or a
developer defined Apex class.

20. How can the wire service be used with Apex?

As with all Apex to be used within any Lightning component, the methods must first be
set to be “Aura Enabled”, using the Apex annotation “@AuraEnabled”, exposing the
method to the Lightning components. Furthermore, the annotation must be expanded to
state that it is cacheable like “@AuraEnabled(cacheable=true)”. This annotation disables
all DML operations, meaning the method only returns data, never mutates it. The method
can then be imported into the LWC, like any other, and used as a wire adapter.

21. What is the Lightning Data Service?

The Lightning Data Service (LDS) is a set of Salesforce provided components, wire
adapters and functions. It’s purpose is to manage data on our behalf, allowing us to
easily read and write records and to reflect those changes in all other components
utilising the LDS, be they standard Salesforce components, or our own custom ones
built on top of this technology.

22. How can we use the User Interface API?

The UI API exposes a couple of wire adapters and several JavaScript functions we can
utilise within our components as needed. This could be getting the page layout details
for a specific object, or getting dependent picklists for a record type, all while respecting
the sharing and permissions of the running user.

23. What benefits are there to using the UI API?

The main benefits to using the UI API are the same as using the LDS, we get cached data
for improved performance and ease of data management, ensuring all our components
are displaying the correct data. Alongside these, there is the added benefit of reducing
the amount of Apex code written, e.g. we no longer need to write controller methods for
simple record updates.

24. Why wouldn’t we want to use the UI API?

As good as the LDS and UI APIs are, there are some scenarios where we cannot use
them, for example if we are working with groups of records, we would need to write our
own custom Apex methods for retrieving data. However, that doesn’t mean we must use
one or the other, for example, if we were required to update a single record from the list
we retrieved via Apex, the UI API can satisfy that requirement.

25. Why wouldn’t we want to use the wire service?

The wire service is great at provisioning data to the client and keeping that cached, but
when we are required to create or update records, the wire service offers us nothing to
do so, since its purpose is entirely the provisioning of data. Another scenario is when we
would like to trigger our Apex from a button, or some other user action. In both these
scenarios, utilising imperative Apex is a much better choice, due to the increased level of
control.

Debugging and Development

26. What tools can we use to ease our development?

There are several tools Salesforce provides for us to assist in development regardless of
whether we are developing Aura components or LWC. The most notable of which is the
SFDX extensions for VSCode, which provide us an IDE experience, far better than that of
the Developer Console.
27. How can we debug our components?

There are several different ways we can approach component debugging, the fastest and
most simple is to simply provide console logging statements to log variables throughout
code execution, however this is an extremely limited approach and there are far better
ways to debug our components. The first step is to enable “Lightning Debug Mode” to
remove minification and provide better error messages. Alongside this, we can use our
browsers debugging tools to provide breakpoints to examine the precise execution of
code within our components, review variables at run time, and step through our code to
better understand what’s going on and find what’s going wrong.

Bonus Questions

The following series of questions have no right or wrong answer but are a great way for
an interviewer to understand how you work on a more detailed level. They give you a
completely open platform to discuss and really flex those developer muscles, a great
opportunity to make yourself stand out!

28. Tell me about a previous project you have worked on.

A very open-ended question for sure! The purpose of this question is to give you an
open platform to discuss your previous pieces of work. Ideally, pick something recent
that relates to the interviewer’s industry that you’re proud of. Don’t worry if you can’t
match those criteria exactly! If you’ve trying to get your first developer role, think of past
projects to go through that shows off your skills – if you’re new to Salesforce, it doesn’t
even need to be a Salesforce project, for example if you were doing projects to help
practice your skills, those are a great talking point.

29. What were the challenges you faced in that project?

Think back about the project and talk about what you found the most challenging
aspects and why. Following this up with how you overcame them (be it some clever
coding, or simply going to a senior for assistance) can really show off some of the soft
skills us developers need to use. Don’t worry about the specifics of how you overcame
those challenges, instead focus more on the journey and the learnings from that.

30. In hindsight, what would you do differently?

Be honest and open here, if you didn’t think something went well raise it and explain
what you wish you’d done instead. The point of a question like this is to show that you
can learn and improve from previous experiences, so take a little time to reflect on
previous projects!

Summary

Hopefully, the above questions have provided a bit of an insight into the mind of a
technical interviewer. These questions are not an extensive list, and every interviewer
will have their own style and pool of questions to draw from.
These may range from the more technical ones, which are a good chance to show off
your understanding of the platform and the different toolsets on offer when we develop
(e.g. the Lightning Data Service), to ones with an intention to better understand how you
think, approach a challenge and you as a person (e.g. the bonus questions, my personal
favourite!).

You might also like