Salesforce Interview Questions and Answers 1649259908
Salesforce Interview Questions and Answers 1649259908
Salesforce Interview Questions and Answers 1649259908
➢ Condition Based Error message which avoid creation updation of data based in business
rules.
➢ If the criteria is true ,Error message is displayed,if it is false record is Saved
➢ Validation rule is fired when user want to save the record insert/update
1) Logical Errors
Eg2:DOJ<DOB
FORMULAES
Auto Calculated Fields –1)based on current record values 2) based on parent record values
Not stored in DB
Two parts
Examples
# 1Age of Case NOW() – CreatedDate Number 2) Age of Consultant todays date – dob 3)Experience of
Consultant --todays date – doj
# 2 Salary Band 1)IF(Salary__c > 10000, “Band A” , “Band B”) Text
if (salary is grater than 10000 and type is vendor) or (salary < 10000 and type = intern )
Eligible for Bonus IF(AND(ISPICKVAL(Type__c, “Employee”), Salary__c > 10000),true, false) Checkbox
Work Flow Rules Process Builder Assignment Rules Approval Process Escalation Rules Auto
Response Rules Queues Public Groups Hirarchical Relationship ( user) Flows
What is User?
So what is a user? A user is anyone who logs in to Salesforce. Users are employees at your company,
such as sales reps, managers, and IT specialists, who need access to the company's records.
Every user in Salesforce has a user account. The user account identifies the user, and the user account
settings determine what features and records the user can access. Each user account contains at least
the following:
Username
Email Address
License
Profile
Role (optional)
What is Profile?
Profiles determine what users can do in Salesforce. They come with a set of permissions which grant
access to particular objects, fields, tabs, and records. Each user can have only one profile. Select profiles
based on a user’s job function (the Standard User profile is the best choice for most users). Don’t give a
user a profile with more access than the user needs to do their job. You can grant access to more items
the user needs with a permission set.
What is Roles?
Roles determine what users can see in Salesforce based on where they are located in the role
hierarchy. Users at the top of the hierarchy can see all the data owned by users below them.
Users at lower levels can't see data owned by users above them, or in other branches, unless
sharing rules grant them access. Roles are optional but each user can have only one. If you have
an org with many users, you may find it easier to assign roles when adding users. However, you
can set up a role hierarchy and assign roles to users at any time. Roles are only available in
Professional, Enterprise, Unlimited, Performance, and Developer editions of Salesforce.
Salesforce provides CRM software and cloud-based solutions that help enterprises to
connect better with their customers. It supports businesses to manage their customer's data
and track their activities efficiently.
1. 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.
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.
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.
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.
• Developer
• Developer Pro
• Partial Copy
• Full
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.
5. 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}
Visualforce pages are served from a different domain to improve security standards and
block cross site scripting.
8. 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.
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.
9. 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:-
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 group, filter, 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.
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.
12. What are the different types of reports available in Salesforce? Can
we mass delete reports in Salesforce?
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.
In a Lookup relationship, even if the parent record is deleted, the child record will not be
deleted.
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.
“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.
17. 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.
19. 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: ” “.
Time dependent workflow action cannot be create for: “created, and every time it’s
edited”.
21. 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 Hierar
chy 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.
22. How many active assignment rules can you have in a lead/ case?
23. 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.
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.
25. 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.
• Lookup fields
• Formula fields whose reference spans over other entities
• Fields having dynamic date functions like:- TODAY() or NOW()
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.
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. Debug & Deployment Tools – Salesforce Interview Questions
28. What are the different ways of deployment in Salesforce?
1. Change Sets
2. Eclipse with Force.com IDE
3. Force.com Migration Tool – ANT/Java based
4. Salesforce Package
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: Text, Number, E-Mail and Auto-
Number.
30. 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.
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.
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.
<apex:form id="theForm">
<apex:pageBlockSection >
{!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>
Look at the below piece of code to understand how a controller method is called using
actionfunction.
<script>
function JSmethodCallFromAnyAction()
callfromJS();
</apex:page>
35. 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().
36. How many records can a select query return? How many records can
a SOSL query return?
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:
<apex:component>
</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>
38. What are the three types of bindings used in Visualforce? What does
each refer to?
Data bindings and Action bindings are the most common and they will be used in every
Visualforce page.
39. 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.
• 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>();
40. How can you embed a Visualflow in a Visualforce page?
For example:
</apex:page>
<flow:interview name="flowuniquename"/>
<apex:page>
6. Click Save.
7. Restrict which users can access the Visualforce page.
a. Click Visualforce Pages.
b. Click Security next to your Visualforce page.
c. Move all the appropriate profiles from Available Profiles to Enabled Profiles by
using the ‘add’ and ‘remove’ buttons.
d. Click Save.
8. Add the Visualforce page to your Force.com app by using a custom button, link, or Visualforce
tab.
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).
42. What are the different methods of batch Apex class?
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){}
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.
• Primitive types
• Collections
• sObjects
• User-defined types
• Built-in Apex types
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.
SOQL vs SOSL
SOQL (Salesforce Object Query Language) SOSL (Salesforce Object Search Language)
Only one object can be searched at a time Many objects can be searched at a time
Can query any type of field Can query only on email, text or phone
Can be used in classes and triggers Can be used in classes, but not triggers
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.
49. What is the difference between public and global class in Apex?
Q #5) What is the limit of Data.com records which can be added to Salesforce?
Answer: 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.
Q #8) What is the use of SOQL? What are the differences between SOQL and SOSL?
Answer: 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.
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 Uses “FIND” keyword for retrieval of record fro
database. database.
It allows to perform DML operations on query results. It is not possible to perform DML on search res
This is used in a query ( ) call. This is used in a search ()call in the API.
Q #10) What are Workflows in Salesforce? What are the types of Workflow?
Answer: Workflow in Salesforce is for automating the standard internal processes and
procedures and thereby save time across the organization. The main container for a set of
workflow instructions is a Workflow Rule. It is possible to sum these instructions as an
if/then statement.
There are two components of the workflow rule i.e. criteria and the action. The criteria are
the ‘if’ part of the if/then statement and the action is the ‘then’ part of the if/then statement.
For Example, Send an email alert to the concerned manager, when a contract is about to
expire. The workflow rule is run when the criteria are met.
There are two types of workflow in Salesforce:
1. Immediate Actions: It fires immediately when the workflow criteria are met. The
associated actions email alerts/field updates also take place with immediate effect.
2. Time-dependent Action: When the criteria are met, the associated actions take
place after a certain duration of time. This time is based on a value set.
Answer: A dashboard as shown in the above figure summarizes and portrays your
Salesforce data in a graphical layout. This offers insights at-a-glance, for any device and for
any targeted audience. In this figure, it throws light on the Sales reps of your organization.
Moreover, a dashboard visualizes your business scenario and allows you to make decisions
based on the real-time data gathered from reports. A Dashboard has a page layout and
displays multiple dashboard components. Multiple reports appear side-by-side on the same
dashboard.
Q #18) What are the options for deploying from Sandbox to Production org? What is
an Outbound Change Set?
Answer: Various methods are adopted for deploying a sandbox to production. The main
method is using the Change Sets. A Change Set enables to create and test a new object in
the sandbox and then send that to the production org. It contains information on 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 current org to another org the Outbound Change Set is
used. Once received by the receiving org it is called Inbound Change Set.
Q #22) What are the differences between Workflow and Process Builder? What is the
difference between Trigger and Process Builder?
Answer: 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 the 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, submit 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.
Q #26) What is the difference between Page Layout and Record Type?
Answer: 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:
Use drag and drop in the above section to create the page layout.
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.
For Example, A record type can be created with different picklist values for differentiating a
sales deal with various service engagements.
Q #27) What is a Wrapper Class in Salesforce?
Answer: 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 process them for a specific action.
Q #34) Is it possible to customize Apex and Visualforce directly from the Production
Org?
Answer: 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.
Q #35) When is it possible to use Apex over Workflow rules or Process Builder?
Answer: 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.
The minimum test coverage must be 75 % for deployment in the production org.
Q #39) What are the types of Collections in Apex? Explain List and Set in Collections.
Answer: 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.
Visualforce Questions
Q #42) What is Visualforce? How to hide the Header and Sidebar in the Visualforce
Page?
Answer: Visualforce is a framework for the Force.com platform which enables developers
to build custom interfaces that can be hosted natively on a lightning platform. It has a tag-
based mark-up language like HTML.
Each tag is equivalent to a coarse or fine-grained user interface components such as a
page section, a related list or a field. It has 100 built-in components. The developers can
create their own components using Visualforce.
The attribute showHeader is set as “false” to hide the header of a Viusalforce page. To hide
the sidebar, the sidebar is set as “false”. These two attributes are a part of the Visualforce
component <apex page>. The attribute has a Boolean value.
Programmatic Features
Q #44) What is the difference between Standard and Custom Controller?
Answer: Standard Controllers generate automatically for all standard pages. They contain
the same logic and functionalities that are used for any standard Salesforce page. They can
be used with standard and custom objects.
Custom Controllers override the standard functionality of a standard controller which
appears on a Visualforce page. Apex can be used for writing a custom controller or a
controller extension.
The number of records displayed on a page by default is 20. If you want to change the
number of records displayed on a page, then just make use of the method pageSize, as
shown in the below diagram.
Q #46) How to call a Controller Method within a JavaScript?
Answer: To call a controller method (Apex function) from JavaScript, you need to
use actionfunction.
Below is a code snippet for your reference:
Q #51) What are Packages? What are the types of Packages? What are Managed
Packages?
Answer: A package is a bundle/collection of a list of components or related applications.
There are two types of packages:
• Managed
• Unmanaged
Managed Packages are used to sell and distribute applications to clients. Developers can
sell user-based licenses and applications through the AppExchange for the managed
packages. These are fully upgradable. In the case of seamless upgrades, removal of
objects or fields is performed.
Q #55) Which tag is used to create a Button? Which tag is used for a URL link? Which
is the tag for Password Protection?
Answer:
• The tag <apex: commandbutton> is used for the button.
• The tag used for URL link is <apex: outputLink>.
• The tag used for password protection is <apex: inputSecret>.
Q #56) What is Obligatory Outer Tag? Which tag is used for displaying a video in the
Visualforce?
Answer: The tag <apex: page> is the obligatory outer tag. The tag<apex: flash> is used to
display a video in the Visualforce.
Integration Questions
Q #67) What is the use of an Outbound Message?
Answer: An Outbound message is a part of the workflow and is created for a Workflow rule.
It helps to send information to a specified URL endpoint. Information contained in the fields
is specified during the creation of the outbound message. It sends secure and configurable
API messages to a designated listener.
Miscellaneous Questions
Q #72) Which Platform is used for developing an App in Salesforce?
Answer: The force.com platform is used for developing an App in Salesforce.
Q #80) Can we reference Standard Controller and Controller Attribute at the same
time?
Answer: No, it is not possible to reference both the Standard Controller and the Controller
at the same time. Use the reference attribute to reference the standard controller with a
custom controller.
Here is how these are referenced:
Q #81) What is the Development Mode? When do we enable the Development Mode?
How do we do it?
Answer: The best way to build Visualforce pages is to enable the development mode. It
makes it easy to simultaneously view the code and output.
The Development Mode helps in:
• Define new Visualforce pages by entering a new URL.
• Error messages containing detailed stack traces than what is received by the
standard users.
• Displays a footer with the page’s view state, a link to component reference
documentation, and any associated controller link.
• Offers Page Markup Editor for highlighting find-replace functionality as well as auto-
suggest for attribute names and component tags.
Testing Questions
Q #82) Why do You write Test Classes?
Answer: Test classes refer to the maximum lines of code covered when your execution
takes place. If you want to develop a robust and error-free code, then the test classes are
used as a tool for testing your code. It ensures that if any Apex customization has to be
deployed in your org, then it will operate properly.
Every test class will be annotated with @isTestkeyword. In fact, we must annotate a test
class with @isTest, for defining as a test class. If the keyword testMethod is used within
any method within a class, then it is called as a test method.
Q #83) What is the Minimum Test Coverage that is required for Deployment?
Answer: At least 75 % of your Apex code must be covered by unit tests in Salesforce, and
all these tests must be completed successfully.
Objects in Salesforce are used as database tables that are used to store information of an
organization. We have two types of objects in salesforce, they are.
Standard Object: These are the objects provided by the salesforce, which include
contacts, accounts, opportunities, leads, cases, campaigns, products, contracts,
dashboards, etc.
Custom Object: This includes the modifications made to the Salesforce by users. It stores
the essential and unique information of an organization. Custom Object includes page
layouts, relationship to other objects, custom user interface tab, custom fields, etc.
An App in Salesforce.com is a container that holds various things such as a logo, name,
and a set of required tabs. It is also called a group of tabs that work together to prove the
functionality that you are looking for.
In Salesforce, you can customize apps to match your requirements, or you can build new
applications by combining custom and standard tabs.
The external lookup relationship is used to connect the child object to the parent object. The
child object may be either a custom, standard, or external object. It uses to identify the
correct map of the child object with the parent external object. The external
lookup relationship values fields are matched against the External Id values.
Transfer record is a type of function used to grant permission. If a user has permission to
share a record with others, then he can share the records that have read-only access.
The computer system executes one or more tasks according to the set of rules and
scheduled tasks.
The trigger is defined as an Apex code that executes before or after the following functions
such as insert, update, delete, etc. trigger enables to perform custom actions before and
after modifications to the records of Salesforce.
• Field update
• Task
• Outbound message
• Email alert
29. What are the main things that need to consider in the “Master-Detail
Relationship”?
Record level access is determined by the parent, Mandatory on the child for reference of
the parent, cascade delete (if you delete the parent, it can cascade delete the child).
30. How many records can be shown in matrix, tabular & summary
reports?
If you delete the parent record in the MDR, the child record also gets deleted in MDR.
38. How we can create an MDR on those objects where we already have
records?
No, we cannot change the license when we are creating the profile.
It creates a link between the custom object and the standard object recorded in a related
list. This is helpful to find the product's defects.
We have some fields which are indexed by default in Salesforce, which are :
• Name
• ID
• Owner fields
• Master-detail relationship fields
• Lookup fields
• Last modified dates
• Audit dates
The Fiscal year is known as the starting and ending date of a company's financial year. We
have two types of financial years in Salesforce which are as follows.
There are many custom fields available they are Picklist, Currency, Date, Text,
Picklist (multi-select), Email, Percent, Number, Phone, Text area, Lookup relationship,
Geolocation, Checkbox, Master-Detail relationship, etc..
49. What are the different ways to store various types of records in
Salesforce?
We have five different ways in Salesforce to store various types of records such as images,
files, and documents.
They are
• Attachments
• Google drive
• Chatter Files
• Libraries
• Attachments.
50. What is the main difference between data table vs page block table
tags?
Page block:
DataTable:
There are many things that can contribute to the data loss in Salesforce. Which includes :
Junction objects are mainly used to create a many-to-many relationship in Salesforce. If you
consider a recruiting application as an example, you can find a position that is linked to
many candidates, and in the same fashion, a candidate can apply for many positions.
The sharing rules are used only for allowing greater access to records not for restricting.
Role Hierarchy :
If we add a user to a role, the user who is above in the role hierarchy will have read access.
Setup → manage users → roles → setup roles → click on ‘add role’ → provide
name and save.
OWD:
OWD can be Private, Public Read Only, Public Read and Write.
Manual Sharing :
We can see this button detail page of the record and this is visible only when the OWD
setting is private.
Using the insert method we can insert the records but if any error occurs in any record
system will throw an error insertion fail and none of the records are inserted. If we want to
execute partially the success of bulk insert operation we will use database .insert.
58. Does the user can create insert their own custom logo while creating
their own custom applications?
Yes, users can upload their custom logo in documents, and then they choose that logo for
the organization.
We can customize different things on page layouts like Fields, Buttons, Custom Links, and
Related Lists. We can also create sections.
61. Can the governor limit perform partial DML activity? Eg: we are
inserting 200 records in a loop, the Governor limit is hit at the 151st
record, then will those 150 records be created?
The interface is a collection of unimplemented methods. This will specify the signature of
the method, types of inputs that we pass the method specify what type is given as an
output.
• 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.
Apex enables developers to add business logic to most system events like button clicks
related to record updates and VisualForce pages.
The batch apex class deploys the database batchable interface with the three methods as
follows:
• Start
• Finish
• Execute
Start: We use the start method at the beginning of the batch apex job. We use it for
collecting the objects or records, for passing them to the interface for executing. It returns a
DatabaseQueryLocator object that comprises objects or the records sent to the job.
Finish: We call this method once we finish the batch processing. We use this method to
send confirmation emails or to execute the post-processing operations.
Execute: We use this method for every batch of the records that are sent to the method.
We use this method for data processing. This method does the following:
Email services are an automated process that uses Apex classes to process the contents,
Headers, Attachments of Inbound Email.
Note:
For Example, the following table represents a map of countries and currencies
Batch Apex: Batch Apex allows you to define a single job that can be broken up into
manageable chunks, whereas every chunk can be processed separately.
In the Batch Apex it will fetch all the records on which you want to perform the field update
and divide them into a list of 200 records and on every 200 records operation is performed
separately.
This would help us to execute on more than 10,000 records as it won’t perform an operation
on all the records in a single transaction instead it dividing them into a Number of subtasks
where each subtask may contain records up to 4000.
Example:
If you need to make a field update of every record of account object in your organization,
then we have governing limits that would restrict us from achieving the above task.
Reason: In a single transaction we can process only 10,000 records. Now in the above
case if we have more than 10,000 records in the organization then we can not perform this
field update.
Anybody who wants to schedule their class they have to implement the schedulable
interface.
Schedule Interface: The class that implements this interface can be scheduled to run at
different intervals. This interface has several methods that are
The trigger is an Apex Code that executes before or after. The following types of DML
Operations:
• Insert
• Update
• Delete
• Merge
• Upsert
• Undelete
1. Before Triggers
2. After Triggers
Before Triggers: Before Triggers can be used to update or validate values of a record
before they are saved to the database.
After Triggers: After Triggers Before Triggers can be used to access field values of the
records that are stored in the database and use this value to make changes in other
records.
Syntax:
• This type of sharing is available only with users to modify all data permissions. Only
these users can add/change apex-managed sharing.
• Apex Managed Sharing uses a Sharing reason (Apex Sharing Reason)
77. What is the Usage of the apex program within the VisualForce page?
When you want to call the apex class on the VisualForce page we have to declare in the
following format.
Whenever we call a VisualForce page in which the controller attribute is defined it will first
create an object for the apex class which is defined in the controller. When an object is
created for the apex class first it involves the constructor.
Ans: Static resources allow you to add the content that you want to reference it on the
VisualForce page, which includes things like images, Javascript, archives, CSS files, etc.
The maximum size of a static resource of an organization is 250 MB.
A query language that allows you to construct simple but powerful query strings and to
specify the criteria that should be used to select the data from the platform database. SOQL
Stands for Salesforce Object Query Language.
We must avoid using index values like Trigger.New[0] as we never know how many records
we get in Trigger.New at runtime.
Insert ListForBulkDML;
Salesforce Object Query Language is used to query records from the database.com
based on the requirement.
1. Static SOQL
2. Dynamic SOQL
3. Static SOQL:
4. The Static SOQL Statement is written in [] (Array Brackets)
5. These statements are similar to IINQ (Ion Integrated Query)
Example:
Dynamic SOQL:
It is used to refer to the creation of a SOQL string at run time with Apex code.
Syntax -
Example:-Queries
List accountList = [SELECT ID, Name, FROM Account];
List accountList = [SELECT ID, Name, FROM Account WHERE annual
revenue<10000];
With API version 18.0 and later/you can use group by with aggregate functions, such
as sum() or max() to summarize the data and enable you to rollup query results rather
than having to process the individual records in your code.
SOSL statement evaluates the list of sObjects, where each list contains the search
results for a particular sobject type, The result lists are always returned in the same
order as they were specified in the query.
If a SOSL query does not return any records for a specified sObject type, the search
results include an empty list for that sObject.
Example: You can return a list of accounts, contacts, opportunities, and leads that
begin with the phase map.
List < list < subject >> search list = [ find 'map*' In ALL FIELDS
RETURNING Account (ID, Name), contact, opportunity, lead ];
Note:
• The syntax of the class on Apex differs from the syntax of the FIND clause in the
SOAP API.
• In Apex, the value of the FIND cause is demarcated with single quotes.
Example:1
FIND 'map*' IN ALL FIELDS RETURNING account (Id, Name], Contact, Opportunity,
Lead. In the Force.com API, the value of the FIND Clause is demarcated with braces.
Use javascript remoting in VisualForce to call methods in apex controllers from javascript.
• The remote method invocation you add to the VisualForce page, written in javascript.
• The remote method definition in your Apex controller class.
• This method definition is written in apex, but there are few differences from normal
action methods.
• The response handles callback function you add to or include in your VF page,
written in javascript.
To use javascript remoting in a Visualforce page, add the request as a javascript invocation
with the following form:
Syntax -
Configure a remoting request by proving an object with configuration settings when you
declare the remoting request.
97. If one wants to actually compare the variable name in a query what
operator should be used?
98. When one wants to pass the collection to the query instead of
passing one value which keyword helps us?
IN - keyword.
inputField - copy the field from any object and display on a VF page | like copy paste work.
Add javascript file in Static Resource setup -> develop -> Static Resources -> click on ‘New’
-> Name: filename and add file from local desktop and save.
Use the future annotation to specify that these methods are executed asynchronously.
Syntax:
A web directory where hundreds of app exchange apps are available to Salesforce
customers to review, demo, comment upon, and /or install. Developers can submit their
apps for listing on the appexchange directory if they want to share them with the
community.
106. Which tag is used with both radio buttons and picklists to create
the selectable values?
We use <Apex:selectoption>
Trigger:
109. What are some apex classes that are commonly used within?
The transient keyword prevents the data from being saved into view state. This should be
used for very temporary variables.
The maximum number of field dependencies we can use is a VisualForce page is 10.
Click on your Name tab, then click on Personal and you will find Reset my security token.
An app development model that allows apps to be defined as declarative “blueprints,” With
no code required. Data model, objects, forms, workflows, and more are defined by
metadata.
114. What is S-Control?
S-Controls are the predominant salesforce.com widgets that are completely based on
JavaScript. These are hosted by salesforce but executed at the client-side. S-Controls are
superseded by VisualForce now.
A wrapper or container is a data structure, a class type, or an abstract data type that
contains multiple collections of objects. It helps in displaying various objects on a
VisualForce page in a single table.
Public websites and applications that are directly integrated with your Salesforce
organization without requiring users to log in with a username and password.
Apex sharing: Share object is available for every object(For Account object share object is
AccountShare ). If we want to share the records using apex we have to create a record to
the shared object.
Yes, of course! We can create and edit the VisualForce pages in both the production
environment and in a sandbox. The only thing you can not do in a production environment
with a VisualForce page is adding the unique values for which you need to do this in the
sandbox.
No, you can not do that if you want to make any edits to the apex trigger/apex class that
should be done in a sandbox environment.
122. What are the things that can be customized on page layouts?
Page layouts allow you to personalize or customize the given page objects or records. It
helps in customizing or designing the page according to your requirements. Page layout
editor helps you in customizing the pages. Using this page, you can customize things like
buttons, fields, custom links, and related lists.
123. How to invoke batch apex job (or) how to execute the batch apex
job programmatically?
Syntax:
Note: The class name that we are passing to the database.execute batch( ) method should
be the object of the class which has implemented the database.batchable interface.
124. Will Visualforce still support the merge fields usage like S-control?
Yes. Just like S-Controls. Visualforce pages support embedded merge fields.
We use the Roll-up summary field to calculate the values for the associated records, for
example, a related list. We can also use it for creating the values for a master record-
according to the values in detail records. But, we must connect the master and the detail
with a master-detail relationship.
2) Explain Queues?
In Salesforce, Queues help us to distribute, prioritise, and assign the records to the teams
for sharing workloads. Queues are applicable to leads, service contracts, custom objects,
cases, etc.
Workflow Task
When we have to assign the tasks to a salesforce user, you haunt a workflow task.
Workflow task allocates a new task to a role, user, or record owner. It assists us in defining
different task parameters like a priority, status, due date, and subject.
Workflow Alert
Workflow Alert is an email that an approval process or a workflow rule creates in the
salesforce and is transmitted to different recipients.
8) Explain Auto-Response?
Auto-Response is about transmitting emails to leads or cases for particular record attributes
and promptly responding to customer inquiries or issues by establishing the auto-response
rule. At the same time, we can set one rule for a lead and one rule for a case.
In Salesforce, we use custom labels for creating a multilingual application. Using the native
language, they give information to users in the form of help texts and error messages. We
can define the custom labels as custom text values that we can access from the Apex class
or Lightning components and promptly or even the Visualforce page. We can translate
these values into the language supported by the salesforce. Through the following path, we
can access custom labels:
Guest users are the users who do not have user accounts in our organization. They are
also known as unauthorized users as they do not have to log in. We can make the pages
accessible. Unauthorized users can create or edit the records.
Generally, we have various limitations and considerations for assessing. Yet, we can use
this feature for solving use cases, and we do it financially because the guest user licenses
are free.
To assure that our code satisfies particular standards, Apex test coverage displays to you
how many lines of code in our classes or triggers have been tested by the tested methods.
Test coverage percentage is the result of the number of the covered lines divided by the
sum of uncovered lines and covered lines. To deploy to production, we need a minimum of
75% test coverage.
Lightning message service is a distinctive salesforce feature that allows interaction between
Aura, Lightning Web Components, and Visualforce over the same lightning page. We can
use the Lightning message service in Lightning Experience only.
First, we have to define the page section that is going to be refreshed, and then we have to
define the event that leads to refreshing. The method changes if the area being refreshed is
similar to the one managing the event. It also relies on if we are processing on the server or
if we have to change the user interface.
8) How can we invoke the javascript controller action by using a
component markup?
By using the action provider, we can invoke the javascript controller action through a
component markup
Application events
By using any component, we can fire the application events, and we can manage them.
Application events do not need any relationship among the components; however, these
components should be a part of an application.
Component events
Child components fire the component events, and Parent components handle the
component events. We use component events when we have to send a value from the child
component to the parent component.
We can perform the above process through Pagination. We can achieve pagination through
the following ways:
Through StandardSetController
Through Offset and Limit keywords in SOQL Query
<apex:pageMessages></apex:pageMessages>
12) What are the differences between Custom Objects and Custom
Settings?
Custom objects have to use SQL queries for fetching Do not need to use SQL queries for fetching the
the records from the database. records.
On Custom objects, we can create apex triggers and On List Custom settings, we cannot create apex
validation rules. triggers and validation rules
We can create a tab for custom objects. We cannot create a tab for custom settings
We cannot customize Apex in the production organization. We must change and deploy
through a sandbox and satisfy test coverage requirements.
14) Can you give an example of Salesforce API and its importance?
Salesforce has different API’s that allow us to communicate with the system in various
ways:
REST API: REST API will enable us to integrate with the salesforce applications through
HTTP methods in either JSON or XML formats.
Bulk: Bulk API gives us programmatic access that allows us to load the data into our
salesforce enterprise rapidly.
Streaming: We can use Streaming API for receiving the notification for the changes to the
salesforce data that equal the SOQL query we define. Streaming API is functional when we
have to push the notification from server to client according to the criteria we define.
We use isBlack() for the text fields. Since text fields cannot be NULL, even though nothing
is given as a value, ISNULL() function fetches only empty values. If we use ISNULL() with a
text field, then it returns false.
Salesforce records data on the details like customer details, sales numbers, customer
served, repeat customers and use of these records for creating detailed charts, dashboards,
and reports. In this way, it tracks the sales of our organisation.
18) What is the limit of the Data.com records that we can add to
Salesforce?
In the user section of Data.com, we have to discover our name to see our monthly limit. It
will provide details like how many records we can export or add for this month. The user
enters setup and types the user in the Find box and chooses prospector users.
The batch apex class deploys the database batchable interface with the three methods as
follows:
Start: We use the start method at the beginning of the batch apex job. We use it for
collecting the objects or records, for passing them to the interface for executing. It returns a
DatabaseQueryLocator object that comprises objects or the records sent to the job.
Finish: We call this method once we finish the batch processing. We use this method to
send confirmation emails or to execute the post-processing operations.
Execute: We use this method for every batch of the records that are sent to the method.
We use this method for data processing. This method does the following:
Yes, we use a getter method for returning the values for a controller. Each value computed
by the controller and shown on the page should have a getter method.
On the other way, we use the setter method to pass the user-defined values from the page
markup to the controller. In the controller, we execute the setter method automatically.
The developer console is an incorporated development tool that has a collection of tools.
We use these tools for debugging, creating, and testing the applications in salesforce.org.
The package is a collection of the components list or associated applications. Following are
the kinds of packages:
• Managed
• Unmanaged
We use managed packages for distributing and selling the applications to the clients.
Developers sell user-friendly applications and licenses by using AppExchange for managed
packages. These are entirely updatable in the event of continuous upgrades; we perform
the removal of fields or objects.
The reRender attribute defines an elements list that we can update dynamically through the
AJAX library of the Salesforce. We do not need the entire page to refresh. Only a part of the
page detected by the components is named in the “.rerender” attribute.
By using the <chatter: feed> component, we can display the chatter feed.
Example:
<apex:page>
<chatter: feed entityId=”{!$User.Id}”/>
</apex:page>
Blob variable is the variable that is intended to gather binary data. tostring() converts the
blob back into the string.