0% found this document useful (0 votes)
237 views

Salesforce Interview Questions-Unlocked

This document provides interview questions and answers related to quantum analytics course material. It includes questions about cloud computing, CRM, CRM software, advantages of cloud computing, definitions of cloud computing models like IaaS, PaaS, SaaS, types of cloud deployment and providers, differences between public and private clouds, Salesforce being based on SaaS, common factors between cloud service models, what Salesforce and Force.com are, types of portals and editions in Salesforce, number of releases per year, differences between objects and custom objects in Salesforce, what tabs represent, examples of custom fields, number of custom fields allowed, and what profiles are.

Uploaded by

Yash Patel-Yashu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
237 views

Salesforce Interview Questions-Unlocked

This document provides interview questions and answers related to quantum analytics course material. It includes questions about cloud computing, CRM, CRM software, advantages of cloud computing, definitions of cloud computing models like IaaS, PaaS, SaaS, types of cloud deployment and providers, differences between public and private clouds, Salesforce being based on SaaS, common factors between cloud service models, what Salesforce and Force.com are, types of portals and editions in Salesforce, number of releases per year, differences between objects and custom objects in Salesforce, what tabs represent, examples of custom fields, number of custom fields allowed, and what profiles are.

Uploaded by

Yash Patel-Yashu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Quantum Analytics Course Material

Interview questions

1. What is Cloud computing?


“Cloud Computing is a new trend in IT development, deployment, Delivery
module of business Products, Services that are provided over the internet that
are been used by the real time User“
Read more on Cloud Computing => What is Cloud Computing.

2. Expand CRM and briefly explain about CRM ?


Full form for CRM or Acronym for CRM is “Customer Relationship
Management “. We can understand from the full form where CRM is an
application used to automate Sales and marketing functions by a using a
Software called CRM Software . BY using CRM Software every Company /
Organization plans to increase their revenues and profits. This strategy of
increasing revenue is done mainly by attracting Customers, clients, Sales etc.
Read more on CRM :- What is CRM.

3. List some CRM Software’s?


We have number of CRM softwares which are provided by top CRM
companies some of them are listed below depending upon their present
market.
1. Salesforce CRM.
2. Microsoft Dynamics CRM.
3. Oracle CRM.
4. SAP CRM.
5. Sage CRM.
6. NetSuite CRM.
7. Oracle CRM on Demand.
8. Oracle Sales Cloud(Fusion CRM).
9. SugarCRM.

10. Nimble

Quantum Analytics Course Material |


4. What are the Advantages of Cloud Computing?
Cloud computing has made tremendous growth in processing power, reliability of
the Internet and the great increase in broadband speeds.

It makes tremendous sense to make use of the centralized server of the provider
of cloud computing services as not only does it reduce the costs by a great extent
by making redundant the need to buy several software licenses, it also eliminates the
huge costs required by an organization to maintain and upgrade existing software.
Read more on Cloud Computing Advantages :- Cloud Computing Advantages.
5. What is the definition of CRM?
“Cloud Computing definition given by NIST (US National Institute of
Standards and Technology) : Cloud Computing is a model for enabling
ubiquitous, convenient, on-demand network access to a shared pool of
configurable computing resources that can be rapidly provisioned and
released with minimal management effort or service provider interaction“.
6.What are deployment modes of cloud computing?
Cloud computing services can be provided in four different deployment modes
depending on size and structure of an organization. Four deployment modes
of cloud computing are
1. Public Cloud.
2. Private Cloud.
3. Hybrid Cloud and
4. Community Cloud.
7. What is PaaS?
PaaS means” Platform as a Service”. Here in “PaaS “ the cloud service
providers provides hardware, OS(operating System), Storage, Network
services over the cloud. It is the way like a rent. If there is no service like
Platform and there will be no Applications. Which applications are build on a
Platform.
Get more details on Paas :- What is PaaS.
8. What is SaaS?
SaaS means Software as a Service. Through this Services all the software’s
are distributes over the cloud. By using SaaS no need to install any software

Quantum Analytics Course Material |


all software’s are readily available over the internet .
Get more details on SaaS :- What is SaaS.
9. What is IaaS?
Full form IaaS is “Infrastructure as a Service”. Here in IaaS the cloud service
providers will provides infrastructure like servers, hosting services and
storage. Servers and storage’s are the basic services provide by Cloud
Service Providers.
Get more details on IaaS :- What is IaaS.
10. What is Public Cloud?
Public cloud can be available to people across the world. In this Public Cloud
the user has no control over the resources.
11. What is Private Cloud?
Private Cloud Can be accessed only with in the limited premises. In Private
cloud Cloud Services Providers Cloud infrastructure to particular Organization
or Business specially. This Cloud infrastructure is not provided to others.
13. What is Hybrid Cloud?
Hybrid Cloud is the combination of number of clouds of any type but the
cloud has the ability to allow data and / or applications to be moved from on
cloud to another cloud. Hybrid Cloud is a combination of (Public Cloud
,Private Cloud, Community Cloud). Here API is used as an interface
between public and Private Cloud.
14. What are the different types of Cloud Service providers?
Cloud Service Providers are those who provide cloud services to the business
and customers or consumers. Cloud Service providers will have huge data
base, Data centers, infrastructure, software’s, platform and hardware systems.
Get more details on Cloud Service providers :- Different Cloud service providers
list.
15. Difference between Public and Private Cloud?
Public cloud can be available to people across the world. In this Public Cloud
the user has no control over the resources. Where Private Cloud Can be
accessed only within the limited premises. In Private cloud Cloud Services
Providers Cloud infrastructure to particular Organization or Business
specially. This Cloud infrastructure is not provided to others.

Quantum Analytics Course Material |


16. Salesforce.com is based on which cloud computing Service ?
Salesforce.com is based on Software as a Service ( SaaS).
17. What are common factors on SaaS, PaaS, and IaaS?
SaaS, Paas and IaaS are the three types of services provided using “cloud”.
Their common factor for providing services to organization and customer is the
“CLOUD”depending upon the types of the service they need. Saas provides
Software service on cloud where PaaS provides Platform for application
development and finally IaaS provides Infrastructure.
18.What is Salesforce?
Salesforce is one of the best customer relationship management (CRM)
tool. Salesforce is among one of the best web based flexible and powerful
database provider available in the market.
Get more details on Salesforce :- What is Salesforce.
19.Different Salesforce Editions?
Salesforce.com provides different types of editions and features depending
upon the cloud. For Sales cloud it provides four different types of editions.
They are
1. Group.
2. Professional.
3. Enterprise.
4. Unlimited.
20.Number of Salesforce Editions released per year?`
Salesforce Releases e updates for every year. They are
1. Spring.
2. Summer.
3. Winter.
21.Difference between Salesforce.com and Force.com? Salesforce.com
and fore.com are relatively same but they are different in their functionality.
Salesforce.com is used to develop CRM functionality based application where
force.com is used to customize our data model, business logic and User interface
22.What is Database.com?
Database.com is a type of service provided by Salesforce.com to enhance the
power of Salesforce.com CRM applications. Database.com provides “Data as a
Serivce” to subscribers.

Quantum Analytics Course Material |


23.How many types of portals are available in Salesforce?
In Salesforce.com we have three types of portals. They are
1. Customer Portal.
2. Partner portal.
3. Self Service portal.
24. What is App in Sales force?
App means an Application. In Salesforce an Application consists a group of
tabs which are designed to work as a single function. We have number of
applications in Salesforce.com some of them are sales, marketing, chatter,
site.com, work.com etc.
We can create new application and also customization for the existing apps in
Salesforce.com. To create new app in sfdc go
to Setup=>Build=>Create=>App.
25.Different types of object in Salesforce.com? And why they called
so?
In Salesforce.com we have two types of objects. They are
1. Standard objects.
2. Custom Objects.
Standard Objects :- Standard objects are called so because they are created and
provided by Salesforce.com.
Custom Objects :- Custom objects are those which are created by an User in
salesforce.com.
Get more details on Salesforce objects:- Objects in Salesforce
26.What is an object in Salesforce?
An Objects is represented as a database table which stores organization data
. Objects consists of set of fields and we store data against that field. To view
data Salesforce provided TABS.
To create custom fields go to Setup=>Build=>Create=>Object.
27.What is TAB in Salesforce?
Salesforce.com provides list of tabs and are placed in Tab menu. To access
data of an objects Tabs are used. Tabs in Salesforce are three types they are.
1. Custom Tabs.
2. Visualforce Tabs.
3. Web Tabs.

Quantum Analytics Course Material |


28. List examples of custom field types?
Some of the custom field types are date field, Date/Time field, Currency field,
Checkbox field, Number field, Text field, Pick list field, Email field, percent
fields, phone field, Url field and many more.
Learn how to create custom fields :- Custom fields.
29.What are the Standard and Custom Fields in Salesforce?
Standard fields for custom objects stores the information about created by, modified
by, currency, Name, owner and Division. These are the standard fields in
Salesforce.com.
Custom field for custom objects store unique data or information of an organization.
30. How many custom fields can I created in an object?
In Unlimited edition we can create up to 500 fields per object. In professional
edition we can create up to 100 custom fields per object.
31. What is a profile?
Profiles are those which defines user’s to perform different functions like
settings and permissions in salesforce. It is another way to restrict or control
access to a particular record.
Profile are of two types.
1. Standard Profile.
2. Custom Profile.
Standard Profile : Profiles created by force.com are called Standard Profiles.
Custom Profiles :Profiles created by user are called Custom Profiles.
32. What is Role ?
Role Hierarchy settings make the managers and subordinates to edit, and
view the records. The users in the Hierarchy can be able to view, edit and
report all the data shared.
To create roles in salesforce go to setup=>Administer=>Manage Users=>
Roles.
33.Difference between Role and Profile?
Roles :- Using we can provide record level access like organization wide
defaults, Role hierarchy, sharing rules and Manual sharing. Simply roles
influences record level access.

Quantum Analytics Course Material |


Profiles :- Using profile object level and field level access can be made like
general permissions, tab level permissions, read & write permissions etc.
34. Number of standard profiles available in Salesforce.com?
In salesforce we have 6 standard profile they are.
1. Standard user.
2. Solution manager.
3. Marketing User.
4. Read only.
5. System administrator.
35. How can you use the term “Transfer Record” in profile? Transfer
record is a type of permission in salesforce. If a user is is given access to
transfer a record then the user will have the ability to transfer the records
which have Read access.
36.Tell me about Company Profile?
In salesforce.com company profile consists of information about language, locale,
time zone, number of licenses, storage and available space, about fiscal year,
address and currencies.
37.How to get security token in Salesforce.com?
To get security token in salesforce.com go to your name=>Personal=>Reset
my Security token.
38.What is a Fiscal Year in Salesforce?
Fiscal years in Salesforce are used to define starting and ending date of an
organization financial year.Fiscal years in salesforce are two types they are.
1. Standard fiscal year :- To change starting month of the fiscal year this type is
used.
2. Custom fiscal year :- We can set custom fiscal year dates like quarters,
weeks.
39.What is a dependent picklist?
Dependent Picklist allows to contain multiple values and pick value one among
them or Multiple values among them. Dependent fields depends upon controlling
field.
Read more about dependent Picklist :- Dependent picklist.

Quantum Analytics Course Material |


40.What is Page Layout and Record Types?
Page Layout :- In page layout customization can be done like fields, related lists,
custom links can be arranged.
Record Types :- Record types in salesforce helps to implement business processes
like defining picklist values for standard and custom pick lists.
41.How to delete user from Salesforce?
In salesforce.com, deleting a user is not possible. But the user can be
deactivated by freezing that user in salesforce. To deactivate user go
to Setup=>Administer=>Manage users=>Users=>Click on Freeze.
42.How to freeze users in salesforce.com?
In salesforce.com, deleting a user is not possible. But the user can be
deactivated by freezing that user in salesforce. To deactivate user go
to Setup=>Administer=>Manage users=>Users=>Click on Freeze.
43.In how many ways can we store files, images and documents in
salesforce.com? what are they?
In Salesforce.com we can store files, images and documents in 5 types they
are.
1. Attachments.
2. Documents.
3. Google drive.
4. Libraries.
5. Chatter Files.
44.What are Static Resources?
Static resources helps to store upload images, files, zip files, documents,
javascript files, Css Files which can be used in visualforce pages. Maximum
data storage limit for static resource is 250mb.
45.List some standard indexed fields in salesforce.com?
Id, name, owner fields, lookup fields, master-detail relationship fields, audit
dates like Last Modified dates etc are the standard indexed fields in
Salesforce.com.
46.Which fields are Indexed by default in Salesforce?
Salesforce indexed some fields by default they are Id, name, owner fields,
lookup fields, master-detail relationship fields, audit dates like Last Modified
dates.

Quantum Analytics Course Material |


47.Which fields cannot be added as a custom Index?
Formula fields.
48.In salesforce, Can two users’ can have same profile?
Yes.
49.Is it possible to edit formula field values in a record?
No.

Salesforce interview Questions on Security

50. What is a Sharing Rule?


Sharing rules in Salesforce represent the permissions and exceptions to your
organization. By using sharing rules we can grant access to edit, read,
read/write permissions to user. Sharing Rules are of two types. They are
1. Manual Sharing.
2. Automatic Sharing.
51. What is Manual Sharing?
Manual sharing is the process of sharing records manually.
52. What is permission set?
Permission sets in salesforce.com are the combination of different settings
and permission sets given to user to access records and files.
Note :- Manual sharing is available for only Organization wide default settings
are private to the object.
53. Difference between profiles and permission sets?
Permission Sets : In this Permission sets we define the access level of the
user. Generally we determine what a user can do in the applications. These
are used to grant additional permission to a user.
Profiles : In Object level Security, Profiles are assigned to the user by system
administrator. A profile can be assigned to many users where as a user can
have only one Profile.
54. How can you define Field Dependency?
In Field dependency, we have to fields controlling filed and dependent field.
When a selection is made the controlling field controls dependent picklist
values.

Quantum Analytics Course Material |


Ex:- When a country is selected in dependent picklist then the states are
available to that country. Here country is controlling field and State is
dependent field.
55. How many field dependencies we can use in Visual Force page?
We can use up to 10 field dependencies in visualforce pages.
56. Tell me about Field-Level Security?
In field level security, we control the user what to see, edit, delete of a
particular field in the object.
57. Briefly describe about Field-Level Security?
In field level security, we control the user what to see, edit, delete of a
particular field in the object. In some situation like if we want to grant access
control over Object to a user but the user should not be able to access some
particular fields in that objects then we go for Field Level Security.
Field Level Security can be controlled by Profiles and Permission sets.
= > Profiles.
Page Layouts.
IP Ranges.
Login Hours.
Desktop.
Client Access.
= > Permission sets.
App Permissions.
Record Types.
Tab Settings.
Assigned Apps.
Object Permissions.
Field Level Security.
Apex Classes
Visual Force Pages
58. What are Login Hours and Login IP Ranges?
Login hours are set in an organization to restrict the user’s who tries to login before
or after login hours.

Quantum Analytics Course Material |


To set login hours in an organization go
to Setup=>Administration=>Manage users=>Profiles.
IP ranges are used to restrict any login attempt is done from unknown IP addresses.
Usually organizations maintain login IP ranges.
To set Login IP ranges in salesforce go to Setup=>Administration
Setup=>Manage Users=> Profiles.
59. What is a User Record?
User records consist key information about the user.
60. What is a Record Owner?
Record Ownership : The User or Queue who controls and have the right to
access a record.
Generally there are two types of Owners. They are
1. Users.
2. Queues.
61. What are Organization Wide Defaults?
Organization wide Defaults define the baseline level of access to data records for
all users in an Organization.
Organization wide Defaults are used to restrict access to data(Records).
Organization wide Defaults(OWD) can be defined for Standard Objects and
Custom Objects.
62. What is a Role and Role Hierarchy?
Salesforce uses role hierarchy to automatically to grant access to users by
default. We can not edit Grant Access using Hierarchies for standard objects
and can edit Grant Access using Hierarchies check box for Standard objects.
63. What is Access at the Role Level?
Access at the role level depends upon the organization wide defaults.
64. What are the different types of Sharing Rules in Salesforce and
explain them?
1. Account sharing Rule.
2. Contact Sharing Rule.
3. Case Sharing Rule.
4. Opportunity sharing Rule.
5. Lead Sharing Rule.

Quantum Analytics Course Material |


6. Custom Object sharing Rule.
65. In how many ways can we share a record?
Records can be shared in 5 types they are
1. Role Hierarchy.
2. Organization Wide Defaults.
3. Manual Sharing.
4. Criteria Based Sharing Rules.
5. Apex Sharing.
66. Best Practices of Creating Contact Sharing Rules?
Organization wide default settings are used to set red, write, read/write
permissions
67. How can i provide record level access to user’s in an organisation?
then what should i use from Salesforce security model?
Get more details on record level security :- Record level security in salesforce.
68. If i want Object level accesses then what should i use from
Salesforce security model?
Get more details on object level access. Object Level Security in Salesforce.
69. What are governor limits?
Governor Limits in Salesforce.com are the run time limits enforced by the
apex runtime engine to write scalable and efficient code.
Read more on Governor Limits :- Governor limits in Salesforce.
70. Is it possible to bypass Grant Login access using Hierarchies in case
of standard objects?
Yes
71. Can we use sharing rules to restrict data access?
No, sharing rules cannot restrict data access.
72. Is it possible to create sharing rules for detail object?
No, we can create sharing rules for details objects because they don’t have
owner field.

Quantum Analytics Course Material |


Salesforce Interview Questions on OWD

73. How can you change the setting “Grant Access Using Hierarchies”
for Standard Objects ?

It is not possible , by default Grant Access Using Hierarchies options are


enabled for standard objects and they can not be changed.For custom objects
we can change “Grant Access Using Hierarchies “settings .
74. What are the Mandatory points that you think while creating User and Role
?
It’s Profile.
75. While setting OWD (Organization wide sharing), can we change/modify
the setting of child record in case of Master-Detail relationship?
No, we can not change the settings of child record in Master Detail
relationship because child record is controlled by parent record.
76. Number of accesses available in Organization Wide Defaults and what
are they?
We have 13 types of access in Organization default settings. They are
1. Private
2. Controlled by parent
3. Public Read Only.
4. Public Read/Write.
5. Public Read/Write/Transfer.
6. Public Full Access.
7. Use.
8. No Access.
9. View Only.
10. Hide Details.
11. Hide Details and Events.
12. Show Details.
13. Show Details and events.
77. In Partner Community, external user is having appropriate OWD and
Profile Settings for Opportunity or consider any other Object. However they
are getting insufficient privilege access, what might be cause of this error ?
1. First check that every field used in report has Field level security for

Quantum Analytics Course Material |


external users.
2. Check whether Standard Report Visibility settings are enabled, if it is
enabled user can be able to see reports which are based on standard report
types.

3. Now external user can be able to access sensitive information of internal


user.
Salesforce Interview Questions on Relationships
78. What are the different types of Relationships in SFDC?What are they?
They are four types of Relationships in Salesforce.com. They are
1. Master-Detail relationship.
2. Look-up Relationship.
3. May-Many Relationship.
4. Hierarchy Relationship (we can not use this relationship).
79. What is a “Look-up Relationship”?
No parent is required.
Relationship is optional.
No impact on Security.
Roll-Up summary fields cannot be available.
25 look-up relationships can be created to one Object.
80. What is “Master-Detail Relationship”?
We create Master-Detail Relationship using Junction Object in Salesforce.
Child record must have a associated parent.
Cascade record-level security.
Cascade record deletion.
Roll-up Summary fields can be established.
Standard objects can not be a detail object.
Standard Objects can be a Master object
Maximum 2 Master-Detail Relationships can be created to a Object.
Records can be re parented.
Get more details here :- Master-Detail Relationship
81. What is a “Self Relationship”?
Self Relationship is nothing but creating relationship between two same
objects. This Self Relationship is a Look-up Relationship to the same
object.

Quantum Analytics Course Material |


82. What is Roll-up summary?
Roll-Up Summary field in salesforce calculates values from a set of
related records.

83. Define various characters of Roll-up Summary Field?


1. Roll-Up Summary field can be created only in a object which is referred
as a object with a master detailed relationship field.
2. Roll-Up Summary field can only created for Master-detail Relationship.
3. Roll-Up Summary field can not be created for Look-up Relationship.
4. It Derives the data from child Object.
5. We can’t change field type of a field that we reference in a roll-up
summary field.
6. Auto numbers are not available here.
7. Roll-Up Summary fields are not available for mapping lead fields of
converted fields.
84. List out the functions of Roll-up Summary field ?
Count : It calculates the total number of related records.
Sum : It totals the values of selected fields.
Min : Displays lowest value.
Max : Displays the highest value.
85. What is Many-Many Relationship in Salesforce ?
Many-Many Relationships between two objects can be created.
Junction Object is used to create Many-Many Relationship.
Junction object can also be called as Join Object.
Junction Object links each objects in Many-Many Relationship.
86. How to create Roll-up summary field on look-up relationship?
https://www.salesforcetutorial.com/how-to-create-roll-up-summary-fields-in-
salesforce/
87. Can we have Roll up Summary fields in case of Parent-
Child Relationships?
No.
88. Is it possible to edit Roll up summary field value in a record?
No. roll up summary fields are read only fields and they can not be edited.

Quantum Analytics Course Material |


89. Is it possible to create Roll up summary field on parent object ?
Yes, we can create Roll up Summary field on parent object only with
master detail relation between objects.

90. How to create Many – to – Many relationship?


https://www.salesforcetutorial.com/many-to-many-relationships-in-
salesforce/
91. What is Junction Object?
In salesforce, Junction Object are the part of the objects which joins one
object to another. These are specially used to join many objects in Many to
Many relationships.
92. What are the main things need to consider in the “Master-
Detail Relationship”?
Cascade deletion of the child records is done when parent record is deleted in
Master-Detail Relationship.
93. Can we convert the look up relationship to Master Detail relationship? If
so How can we convert?
Yes, we can convert Look-Up relationship to Master-Details Relationship.
Conversion can be done only if all the fields have valid look-Up fields values
only.’
94. Can we create Master Detail relationship on existing records?
Yes, It is possible to create Master-Detail Relationship on existing record. First
we have to create Look-Up relationship to a record then convert it to master-
Detail Relationship.
95. How to create many to many relationships between two
objects? Many to Many Relationship can be created using Junction
object. Learn how to create Many to Many Relationship in
Salesforce.
96. In case of Master-Detail relationship, on Update of master record can
we update the field of child record using workflow rule?
No
97. In case of Master-Detail relationship, on Update of child record can
we update the field of Parent record using workflow rule?
Yes, we can updatethe field of Parent record using workflow rule.

Quantum Analytics Course Material |


98. What happens to detail record when master record is deleted?
When master Record is deleted, it’s detail records are also deleted.
99. What happens to child record when a master record is deleted in Look-
up Relationship?
Child records are not deleted.

100. A custom object contains some records, now my requirement is to


create field in this object with master detail relationship.

No. we can no create master detail relationship first create look up


relationship and associate look fields for every parent record and then convert
this to Master detail relationship.
101. Can we create both master detail relationship and Look-Up
Relationship at a time ?
Yes, we can create.
Salesforce Interview Questions on Reports & Dashboards.
102.What are different kinds of reports?
There are three types of reports in salesforce.com they are
1. Tabular reports.
2. Summary reports.
3. Matrix reports
103.What are Standard Reports?
Standard reports in salesforce are those provided by salesforce.com.
These type of reports can not be deleted and used primarily for creating
custom reports.
104.What are custom Reports?
Custom reports in salesforce are those created by user with specific criteria.
These type of report can be deleted, edited and stores in personal folders.
105.What is a Tabular report ?
Tabular reports in salesforce are those where the data is displayed in the
form of list. In Tabular reports custom data is arranged with out subtotals.
106.What is a Summary Report?
Summary reports in salesforce are those where the data is displayed in
the form of summary format. Sorting, sum-total of data can be available in
this report.

Quantum Analytics Course Material |


107.What is a Matrix Report?
Matrix reports is salesforce are those where the data is arranged in grid
format having rows and columns. Data is arranged vertically and horizontally
in tables like excel format.
108.What is Trend Report?
Trend reports in salesforce are those which displays historical data. Trend
reports are used to analyse which fields contains data that we want to leave
out.
109.What are Custom Report Types?
Custom report types in salesforce allows us to build framework in the
report wizard when creating custom reports. This custom reports can be
created between standard and custom objects.
110.Who can run Reports?
In Salesforce.com, most reports run automatically when we click on the report
name. If we want to run a report click on “Run Report” to run automatically.
111.What is a bucket field in reports?
In salesforce reports, bucket fields are used to categorize reports records .
When we use bucket field in reports there is no need of creating formula or
a custom field.
112.Is it possible to delete reports using Data
loader? No, it is not possible to delete reports using data
loaders. 113.What are Dashboards?
Salesforce Dashboards are the graphical representation and visual
presentation of reports data in salesforce.
114.What are the different Dashboard Components?
Salesforce dashboard components are used to represent data. Salesforce
dashboards have some visual representation components like graphs, charts,
gauges, tables, metrics and visualforce pages. We can use up to 20
components in single dashboard.
115.What are dynamic Dashboards?
Dynamic dashboards in Salesforce displays set of metrics that we want across
all levels of your organization. Enterprise Editions can use five dynamic
dashboards and Unlimited edition can use ten dashboards.
Read more on Dynamics dashboards

Quantum Analytics Course Material |


: https://www.salesforcetutorial.com/creating-dynamic-
dashboards- salesforce/
116.Can we schedule dynamic dashboards?
No, we can not schedule dynamic dashboards for refresh. It must be
done manually.
117.Explain dynamic Dashboard.
Dynamic dashboards in Salesforce displays set of metrics that we want across
all levels of your organization.
Dynamic Dashboards in salesforce are Created to provide security settings
for the dashboards in salesforce.com. We may have a requirement in an
organization to “view all data” by every user in an organization according to
their access we have to select Run as Logged-in User. There are two setting
option in Dashboards. They are
1. Run as specified User.
2. Run as Logged-in User.
118.Who can access “drag and drop dashboard”?
User who have permissions in managed dashboard can access drag and
drop dashboard.
119.Which type of report can be used for dashboard components?
Summary reports and Matrix reports are used for dashboard components.
120.Which permission is required to set the running user other than
you in dashboard?
The user must have “View All Data” permission is required to set the
running users.
121.What is the use of “floating report header”?
Floating report headers enables us to display the column header visible
on each page when we scroll the report page.
122.How to enable “floating report header”?
To enable floating report header in salesforce go to
Setup=>Customize=>Reports and Dashboards=>User Interface
settings=>Click on enable floating report header.
123.What is Analytical Snapshot in Salesforce.com ?
Analytical Snapshot in Salesforce are used to create reports on historical data.

Quantum Analytics Course Material |


124.What is Workflow?
Salesforce Workflow is a business logic that evaluates the records as
they are created, updated in an object to apply automated process
like Assigning Tasks, Emails, Field Update and outbound message
sending.
125.Different Workflow Components available in salesforce?
In salesforce.com. workflows consists of 5 components they are.
1. Workflow rules.
2. Workflow tasks.
3. Workflow Email alerts.
4. Workflow field updates.
5. Workflow Outbound messages
126.What are the different workflow actions available in Salesforce?
1. Tasks.
2. Email alerts.
3. field updates.
4. Outbound messages
127.What is a Workflow Task?
Workflow tasks in salesforce are used to assigns a task to users. Using tasks
we can specify the Subject, Status, Priority, and Due Date of the task. Tasks
are workflow & approval actions that are triggered by workflow rules or
approval processes.
128.What is a Workflow Alert?
Email alert is one of the action used in workflow and approval. They are used
to generate email template by a workflow rule or approval process and sent to
destination recipients. We can send workflow email alerts to users, contacts
having an valid email address.
129.What is a Workflow Field Update?
Field updates in workflow and approval processes specifies the field that we
want updated and inserting the new value for it. Depending on the field type,
we can choose the following options. They are apply a specific value, make
the value blank, or calculate a value based on a formula you create.

Quantum Analytics Course Material |


130.What is Time-Dependent Workflow?
Time dependent workflows are not executed independently. Time dependent
workflows remain constant in the workflow queue as long as the workflow rule
criteria is valid.
131.Time-Dependent Workflow – Considerations?
When defining time dependent workflows in salesforce we have to use
standard and custom date and date/time fields defined for the object.
We have to specify time using days and hours.
Also add actions to existing time triggers.
132.Limitations of Time-dependent workflow?
When defining time dependent workflows in salesforce we have to use
standard and custom date and date/time fields defined for the object.
We have to specify time using days and hours.
Also add actions to existing time triggers.
133.In which criteria of a workflow – “time dependent workflow
action” cannot be created ?
Created, and every time it’s edited.
134.When you can’t add Time dependent action in Workflow
rule? Time dependent actions in workflow rules can not be added
when the following actions takes place.
When workflow rule is active.
When workflow rule is deactivated and has pending actions in the queue.
When the workflow rule criteria of a record is set to: created, and every
time it’s edited.
When the workflow rule is included in a package.
135.We have a “Time Based Workflow” and there is Action
scheduled to be executed. If we Deactivate the workflow, Scheduled
actions will be removed from queue or not?
Even after deactivating the the workflow, its action will not be removed. It’s
still active in queue.
136.We have “Time Based Workflow” and there is action scheduled
to be executed. Can we delete that workflow?
It is not possible to delete the workflow when the workflow is having
any pending time dependent actions.

Quantum Analytics Course Material |


137.How to clear the Time based workflow action queue?
We can clear time based workflow action queue in two ways they are
1. Make the criteria false.
2. Removing scheduled actions from the queue.
138.While creating workflow on Task, what difference observed on
available actions?
While creating workflow on task we can not find “Send Email”action.
139.Suppose if a record meets workflow criteria for time based workflow
action, the action goes in queue. Later, before the time based action is
triggered, the same record gets modified and the criteria previously met
is changed and now it does not meet the workflow criteria. What
happens to the time based action placed in Queue?
Simply the time based workflow action is removed from workflow queue and
will not get fired.
140. Difference between Trigger and Workflow?

Quantum Analytics Course Material |


Quantum Analytics Course Material

Admin Questions & Answers

1) what is cloud? Advantage and disadvantages


Ans: Cloud computing is the on-demand availability of computer system
resources, especially data storage and computing power, without direct
active management by the user. The term is generally used to describe
data centers available to many users over the Internet.

2) Types of cloud?

a) deployment model: Public, private, hybrid, community

b) service model: Saas,Iaas,paas, on premises

3) what is crm?

Ans: Customer relationship management is a process in which a business


or other organization administers its interactions with customers, typically
using data analysis to study large amounts of information.

4) crm providers?

Ans:

• Salesforce
• FreshWorks
• Keap
• monday.com
• Zoho CRM
• Oracle NetSuite CRM
• Hubspot CRM
• Pipedrive CRM
• Quickbase
• Zendesk
• Sage CRM
• SugarCRM
• Insightly

5) what is Salesforce? it’s application

Ans: Salesforce.com, Inc. is an American cloud-based software company


headquartered in San Francisco, California. It provides customer relationship
management service and also provides a complementary suite of enterprise
applications focused on customer service, marketing automation, analytics,
and application development.

Quantum Analytics Course Material


6) What are Salesforce edition?
Ans: Salesforce provides bundles of features and services that are specific for
the different business needs. These bundles are known
as Editions in Salesforce. Each edition provides the software with the same
look & feel, but all editions differ by the price, functionality, and features.

7) what is multi-talent architecture?

Ans: Multi-tenant architecture, commonly referred to as multitenancy, is a


software architecture in which multiple single instances of software run on a
single physical server. The server then serves multiple tenants.

8) what is governance limit?

Ans : Due to the nature of multitenancy and the fact we are sharing
resources, governor limits are in place to ensure that any
Apex we develop, does not monopolize the shared resources we
are allocated.

9)what is

org?

Ans: An Org is your specific organization's data and meta


data. Salesforce has multiple orgs residing on the same instance. Your data is
itself contained within your org which can share the same instance as
hundreds or even thousands of other orgs

10) what is tab? types of tab?

Ans: A tab is like a user interface that is used to build records for objects and
to view the records in the objects. There are three types of tabs in
Salesforce: Custom object tab. Web tab.

11)what is object &it's type?

Ans: Objects are database tables that allow us to store data specific to the
organization in salesforce. Two type of objects in Salesforce. They are. 1. ...
Examples of standard objects are accounts, contacts, opportunities, Leads,
products, campaigns, cases, users, contracts, Report, and dashboards, etc.

12) what is field?

Ans: A field is like a custom Database column. Object field Store the data for
our records. Salesforce by default provide few fields with salesforce standard
objects those are called standard fields. We cannot
delete salesforce standard field.

Quantum Analytics Course Material


13) Data types in Salesforce?
Ans: A data type is a type of data. ... Some common data types include
integers, floating point numbers, characters, strings, and arrays. They
may also be more specific types, such as dates, timestamps, Boolean
values, and varchar (variable character) formats.

14) difference bet ween picklist and multiselect picklist?

Ans: Picklist: Only one value at a time. Sometimes that's a good thing. Multi-
Select Picklist: One or more values at a time.

15) what is page layout?

Ans: n graphic design, page layout is the arrangement of visual elements on


a page. It generally involves organizational principles of composition to
achieve specific communication objectives

16) how many types of relationship are there in Salesforce?

Ans; There are 6 Types of relationship

1. Lookup Relationship
2. Master Details Relationship
3. External Relationship
4. Self-Relationship
5. Role Hierarchy Relationship
6. Many to Many Relationship

17) difference between lookup and masterdetail relationship?

Ans: Loookup : Master :

Loosely coupled Tightly coupled


Max number of lookup is 25 Max number of master is 2
Not a mandatory Mandatory
Once value is assigned can be changed Cannot be changed
Parent delete child cannot delete Parent delete child also delete
Cannot on lookup Roll up can be made on master-detail

Quantum Analytics Course Material


18) what is approval process? And it's step?

Ans: Approval Process in Salesforce is an automated process that automates


how Salesforce records are approved in your org. Approval
Process in Salesforce is a combination of steps for a record to
be approved/rejected either by a user, queue or public groups.

19) difference bet ween profile and role

Ans:

Role Profile
A profile sets the limit of what a user
The role helps in defining data visibility
can do in the organization
A role defines what user data a user
Profile defines permissions
can see based on hierarchy
Defining role to a user is mandatory
Defining profile is not always mandatory
always
Profiles assist to decide record privileges
Hence, Roles offer a feature to control
i.e. assuming the User can observe the
access to records by impacting
record, it concludes what the User can
reports. For example, filtering “My
function, delete, edit, view on that
Teams”. Roles function if an
record. Most of the time it controls other
organization’s security model (OWDs)
system privileges like export data, mass
is set to private.
email, and many more.

120) what is user?

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

21) what is permission set?

Ans : A permission set is a collection of settings and permissions that give


users access to various tools and functions. The settings
and permissions in permission sets are also found in profiles, but permission
sets extend users' functional access without changing their profiles

22) types of profile?

Ans: There are two major types of user profiles in Salesforce –


standard profiles and custom profiles. While a standard profile is
a profile already provided by Salesforce, a custom profile can be created by
the users based on their specific requirements.

Quantum Analytics Course Material


23) types of licences?

Ans : Salesforce offers these license types.

• Standard User Licenses.


• Chatter User Licenses.
• Experience Cloud User Licenses.
• Service Cloud Portal User Licenses.
• Sites and Site.com User Licenses.
• Authenticated Website User Licenses.

24) what is record level security?

Ans: Record level security in salesforce enables users to access a few


object records. The user owns every record/data, and he/she has full access
to it. In a hierarchy, the users in the senior levels always have the access
that is granted to the users at the junior level.

25) What is owd Mode?

Ans: Organization Wide Defaults(OWD) in salesforce is the baseline level of


access that the most restricted user should have. Organizational Wide
Defaults are used to restrict access. You grant access through other means
like(sharing rules, Role Hierarchy, Sales Teams and Account teams, manual
sharing, Apex Sharing )

26) what is role hierarchy?

Ans: A role hierarchy works together with sharing settings to determine the
levels of access users have to your Salesforce data. Users can access the
data of all the users directly below them in the hierarchy. ... Each role in
the hierarchy just represents a level of data access that a user or group of
users needs.

Quantum Analytics Course Material


27) difference bet ween data loader and import data wizard

Ans:

Data Import Wizard Data Loader


For simple imports of data For complex imports of data
It can load up to 50,000 records. It can load up to 5,00,000 records.
It supports all the custom objects and
only a few standard objects like
It supports all custom and standard
Account, Contact, Campaign
objects.
members, person accounts, Leads,
and Solution.
It supports schedule export. It doesn’t support scheduled export.
Delete operation is not available. Delete operation is available.
Can import cases, events, tasks, and
annot import cases and opportunity.
opportunities
While importing, duplicates can be While importing, duplicates cannot be
ignored. ignored.
It doesn’t require installation. It requires installation.

28) what is record type?

Ans: Record types in Salesforce allow you to have different business


processes, picklist values, and page layouts to different users based on
profile. You might create record types to differentiate your regular sales deals
from your professional services engagements, offering different picklist
values for each.

29) what is report?

Ans: A report is a list of records that meet the criteria you define. It's
displayed in Salesforce in rows and columns, and can be filtered, grouped, or
displayed in a graphical chart. Every report is stored in a folder. Folders can
be public, hidden, or shared, and can be set to read-only or read/write.

30) what is report type?

Ans: n Salesforce, reports are created by first selecting a report type.


A report type is a template which defines the objects and fields that will be
available to use in the report you create. ... Report types can be created to
include both custom and standard objects and fields.

31) what is types of report?

Ans; The four types of Salesforce reports are Tabular, Matrix, Summary, and
Joined. They will allow your Salesforce administrator to pull, send, and review
the data in your Salesforce account in different formats.

Quantum Analytics Course Material


32) what is dashboard?

Ans: Dashboards are incomparable and unique displaying


your Salesforce data in a graphical presentation. Dashboard components
include different types of charts, tables, metrics, and gauges. You can
customize the grouping, summary, and display of data for each of them.

33) What are Static and dynamic dashboard?

Ans: A Dynamic Dashboard enables multiple users to access a dashboard that


was previously accessed only by a single static user. This means that
the dynamic dashboard can be used by a specific user alongside a logged-in
user, and display data specific to both users accordingl y

34)what is validation rule?

Ans: Validation rules in Salesforce verify the data a user enters in a record.
The data should meet the standards specified by the organization. It can
contain a formula or expression that evaluates the data in one or more fields
& returns a value true or false

35) what is 15 digit and 18 digit I'd?

Ans: 15 character ID is a case-sensitive version which is referenced in


the Salesforce user interface. You can use this ID while performing data
operations through the user interface. 18 character ID is the case-insensitive
version which is referenced through the APIs.

36) types of sandbox?

Ans: A sandbox is simply a copy of your database you can use to test new
ideas

In fact, there are 4 different Sandbox types and each of them


have different levels of functions and features.
• Developer Sandbox. A Developer Sandbox is the simplest and
smallest Sandbox. ...
• Developer Pro Sandbox. ...
• Partial Copy Sandbox. ...
• Full Sandbox.

Quantum Analytics Course Material


37) what is bucket field?

Ans: Bucket field in Salesforce Reports is an incredible powerful functionality


used to quickly categorize values for a field in a report without the need to
have a custom formula field at the object level. ... Bucket fields in
Salesforce are available in Tabular reports, Summary Reports and Matrix
reports.

38) types of email template?

Ans: In Salesforce Classic, you can create four different types of email
templates: text, HTML with Classic Letterhead, custom, and Visualforce. All of
these email templates can include text, merge fields, and attached files.

and Workflow?

Quantum Analytics Course Material


Quantum Analytics Course Material
Visualforce Pages in Salesforce

1. Have to worked on visualforce page? If yes what is visualforce page?


Ans- Yes, I have worked on visual force pages.

Visualforce is tag-based markup language to develop a customized user interface in salesforce.


OR
Visualforce is new markup language which is introduced by Salesforce, and by using this language, we can even
render the standard styles of the salesforce. We can at present utilize HTML here in Visualforce. Each Visualforce
tag dependably starts with the “apex” namespace. The Visual Markup language and the business logic are used
in the designing part of the page.

2. Where have you used visualforce page in your project?


Ans- Tell them the requirement where you used visualforce pages in your project.

3. What is the difference between Standard Controller and Custom Controller


Ans-
Standard Controller Custom Controller
1] A standard controller provides the salesforce 1] Custom controller is an apex class that implements
inbuilt functionality (Out of box functionality) to customized logic to visualfore pages. We can override
interact with visualforce pages. You can use the or create new functionality by using custom
standard actions like Save, Edit, Cancel & delete by controllers.
using standard controllers.

Syntax : <apex:page standardController=”Account”> Syntax: <apex:page controller=”Account” >

2] It enforces securities 2] It does not enforce securities

4. What Are The Different Ajax Action Tags? What Does Each Do?
Ans-

Ajax Function Purpose


actionSupport It is used to handle different types of component event like onclick, on ondblclick etc.
Example : call a apex controller method on checkbox select event.

actionPoller It is used to call method of the apex controller after some time interval. It take time
interval in seconds. Example : To check latest commission of the manager.

actionFunction It is used to call apex controller method from Javascript function using ajax request.
actionStatus It is used to display start and stop statuses of AJAX requests.

actionRegion It is used to refresh a particular region of the visualfoce page in the ajax request.

5. What is the visualforce controller in salesforce? What are they?


Ans- Visualforce controller is a set of instructions that specify what happens when a user interacts with
components on visualforce pages, such buttons & links.

There are three types of controllers. They are, Standard Controller, Custom controller & Controller extensions.

Quantum Analytics Course Material


6. Can we use standard Controller & controller attributes at a time?
Ans- No, We cannot use both attributes at a time.
See below syntax to understand

<apex:page standardController=”ControllerName” extensions=”Class1, Class2,..”> Correct

<apex:page Controller=”MYControllerName” extensions=”Class1, Class2,..”> Correct

<apex:page standardController=”MYControllerName” Controller=”MyController”> Wrong

7. How to display a visualforce page as pdf


Ans- renderAs=”PDF”

8. How to hide visualforce page header


Ans- showHeader=”false”

9. Difference between rendered and reRender


Ans-
rendered reRender

It is used to hide or show a particular component. Rerender is used to refresh a particular section of the
visualforce page. We have to just mention the id of
Rendered is bound to a Boolean variable in controller the page section (in the Rerender attribute) that
which can be switched between true and false making needs to be refreshed.
the vf component display or hide depending on
Boolean value.

10. What is the use of with sharing keyword in apex controller


Ans- Be default, apex controller works in system context. In system contex, securities are not applied.
So, to enforce record level securities, we declare an apex controller using with sharing keyword.

11. What is the use of without sharing keyword apex controller?


OR
When without sharing and an apex class with no any keyword (not without or with sharing keyword) does not
enforces record level securities, then why to use without sharing keyword?
OR
What is the difference between when a class is declared as without sharing and no any keyword (no without
keyword OR with sharing keyword).
Ans-
Case 1 Case 2
public class Vehicle { public without Sharing class Vehicle {
} }
public with Sharing class Car extends Vehicle{ public with Sharing class Car extends Vehicle{
} }
Here, when we inherit Vehicle class in the Car class, But here, when we inherit Vehicle class in the Car
then Vehicle class enforces record level securities in class, then Vehicle class does not enforce record level
the Car class. securities in the Car class.

12. Can we perform DML statement in apex controller’s constructor?


OR
I want to create a new account in the apex controller’s constructor? How can I do that.
Ans- No, you can't perform any DML in Constructor because using DML in constructor will slow down
initialization of your object and using insert/update/delete in constructor is a bad practice in any language.

A quick solution would be to place the dml operations in a single method that you call from the page action
parameter.

Quantum Analytics Course Material


Here is the VF page:
<apex:page controller="pageController" action="{!doSomeDMLStuff}">

APEX Controller: public

pageController{ private

boolean doDML;

//constructor
public pageController(){

//run some logic to decide if you need to execute dml statements

if(logic = true){

doDML= true;
}

//the method called from the page action

public pagereference doSomeDMLStuff(){

if(doDML){
//run DML statements

}
return null;
}

}
}

13. If there are three controller extensions in a visualforce page. All three extensions contains Save method.
Save method of which class will get called from visualforce page on save action.
Ans-It will call save method of first extension (left extension).

14. What is View State? What is view state error


Ans- ViewState holds state of the visualforce page that holds state that includes the fields, components and
controller state. Viewstate data in encrypted and cannot be viewed tools like firebug. To maintain state in a
Visualforce page, the Force.com platform includes the state of components, field values, and controller state in a
hidden form element. This encrypted string is referred to as the view state and has a limit of 135KB.

When view state crosses the limit of 170 KB, view state error occurs.

15. How to prevent view state error


Ans-
a) Use filters and pagination to reduce data requiring state.
b) Declare instance variables with a transient keyword when the variable is only useful for the current
request.
c) Use minimum form tags

16. What Are the Effects Of Using The Transient Key Word?
Ans-
The transient key word prevents the data from being saved into the view state. This should be used for very
temporary variables.

Quantum Analytics Course Material


17. Compare And Contrast Custom Controllers And Controller Extensions. How Are They The Same? How Are
They Different?
Ans-
Both allow for custom code to be used, allowing for custom data sets and custom actions. Extensions leverage
the existing data and actions within a standard or custom controller. Custom controllers must contain all data
and actions that need to be executed by the page. Extensions that extend standard controller allow for the pages
which use those extensions to be used in custom buttons, standard button overrides, and over declarative features.

18. Difference between PageBlockTable and Data Table.


Ans-
PageBlockTable-
PageBlockTable uses the Standard style sheets to design the Visual force.
Column Headers will be displayed automatically.
PageBlockTable should be defined inside pageblock or pageblocksection.

DataTable-
Data can be displayed using the custom style sheets(CSS).
Column headers need to be specified explicitly.
No need to specify within the Pageblock or Pageblocksection.

Note:---- Value is a required attribute for both DataTable and PageBlockTable.

19. How to pass parameter from visualforce page to apex controller?


Ans- Using <apex:param> tag.

20. What is Standard List Controller?


Ans- Standard List Controller allows displaying a list of records in a visualvalfoce page. Standard list controller
provides additional pagination actions (First, Last, Next & Previous) compared to the standard controller.

Syntax: <apex:page standardController=”Account” recordSetVar=”accounts”>

defining this controller is similar to standard controller. But need to add one more attribute recordSetVar

21. What are the tasks of standard controller?


Ans- Standard controllers provides the ability to access and interact with structured business data contained in
records displays in the proper user interface.
Standard controller tasks: controlling data, controlling actions and controlling navigation.

22. How can you create a visualforce page in salesforce?


Ans- We can create visualforce pages in two ways.

1. From the setup menu go to Setup-> develop -> Build->Pages-> click on new button to create a page & enter
name & code for visualforce page.
2. From the Visualforce editor. Enter /apex/pagename at the url & create a new page in the visualforce editor.

23. What is <apex:page> tag in visualforce markup?


Ans- This tag represents a single visualforce page. Every page must start & end with this tag.

<apex:page>

<!– Body of the page –>

</apex:page>

Quantum Analytics Course Material


24. How can we enable visualforce editor?
Ans- We need to check the “development mode” check box at the user level to enable visualforce editor.

To enable this, go to user details page check the development mode check box.

25.What Are Expressions Used In Pages To Bind In Controllers?


Ans-
Using methods we can bind.
Getter:Will return value from controller to vf page
Setter:Will pass value from vf page to controller
Action:Will redirect to another page.

26. When Do You Need To Go Beyond A Standard Controller And Code Custom Apex?
Ans-
If you need data beyond the limits of what is available in the standard controller or actions that go beyond the
provided standard actions.

27. What Identifies A Controller As Being An Extension?


Ans-
The controller must declare a constructor which takes another controller explicitly.
For example:
public myControllerExtension(ApexPages.StandardController stdController)
{
this.acct = (Account)stdController.getRecord();
}

28. What Are Some Apex Classes That Are Commonly Used Within Controllers?
Ans-
StandardController, SelectOption, PageReference, Message, etc.

29. Is It Always Necessary To Know Apex To Create Visualforce Pages? When Does It Become Necessary?
Ans-
No, it is not always necessary. You can use standard controllers and VF component tags to accomplish quite a
bit. Apex becomes necessary when you need either a custom set of data or custom actions to be available from
the page.

30. How Can You Create Partial Page Refreshes?


Ans-
Basically, you need to define the section of the page that is going to refresh (typically with a panel of sorts), and
then define the event that will cause the refresh. The method changes depending on if the area being refreshed is
the same as the one handling the event. It also depends on if you are just processing something on the server, or
if you need the UI to change.

31, What is a wrapper class?


Ans- A wrapper or container class is a class, a data structure, or an abstract data type which contains different
objects or collection of objects as its members.

For example, there is a wrapper class that can access the account records and display an in-page block table.
You have an option of a checkbox, and you can associate multiple serial numbers to display the number of
records. So, there can be multiple records and respective serial numbers.

Quantum Analytics Course Material


32. How pagination can be implemented in visualforce page?
Ans- Using limit size and offset

33. What is visualforce page component?


Ans-Visualforce components are small, reusable pieces of functionality—think widgets, panels, user interface
elements, that kind of thing—that you use in Visualforce page markup. You can use standard Visualforce
components, and create your own custom components.

Example:
Visualforce Component Name – VFCompo1

<apex:component >
<apex:attribute name="textValue" description="This is the value for the component" type="String"
required="true"/>
<apex:attribute name="textColor" description="This is color for the border." type="String" required="true"/>
<apex:outputText value="{!textValue}" style="color:{!textColor};"/>
</apex:component>

Visualforce Page Name : VFPage1

<apex:page tabStyle="Account">
<apex:pageBlock >
<apex:pageBlockSection title="myComponent Test" collapsible="false">
<c: VFCompo1 textValue="This Text is blue" textColor="blue" />
<c: VFCompo1 textValue="But this is red" textColor="red" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>

Quantum Analytics Course Material


Quantum Analytics Course Material

Triggers in Salesforce
[1] What is Trigger in Salesforce?
Ans: The trigger is piece of code that executes before or after event on the
following operations such as insert, update, delete, undelete etc. trigger enables
to perform custom actions before and after modifications to the records of
Salesforce.

[2] Write trigger syntax


Ans: trigger trigger_name on SobjectName (event operation1, event operation
2){
}

Example:
trigger prefixName on Account (before Insert, before Update){
}

[3] What are different event of trigger


Ans: before event and after event

[4] What are different operations in trigger


Ans: Insert, update, delete, undelete etc.

[5] What is context variables and which are they?


Ans: Context variable is used to bifurcate different operation logics. OR
All triggers define implicit variables that allow developers to access run-time
context. These variables are contained in the System.Trigger class.

Here is List of all Trigger Context Variables


• Trigger.isExecuting: Returns true if the current context for the Apex code is a
trigger, not a Visualforce page, a Web service, or an executeanonymous() API
call.
• Trigger.isInsert: Returns true if this trigger was fired due to an insert operation,
from the Salesforce user interface, Apex, or the API.

• Trigger.isUpdate: Returns true if this trigger was fired due to an update


operation, from the Salesforce user interface, Apex, or the API.

• Trigger.isDelete: Returns true if this trigger was fired due to a delete operation,
from the Salesforce user interface, Apex, or the API.

Quantum Analytics Course Material


• Trigger.isBefore: Returns true if this trigger was fired before any record was
saved.

• Trigger.isAfter: Returns true if this trigger was fired after all records were saved.
• Trigger.isUndelete: Returns true if this trigger was fired after a record is
recovered from the Recycle Bin (that is, after an undelete operation from the
Salesforce user interface, Apex, or the API.)

• Trigger.new: Returns a list of the new versions of the sObject records. This
sObject list is only available in insert, update, and undelete triggers, and the
records can only be modified in before triggers.

• Trigger.newMap: A map of IDs to the new versions of the sObject records. This
map is only available in before update, after insert, after update, and after undelete
triggers.

• Trigger.old : Returns a list of the old versions of the sObject records. This
sObject list is only available in update and delete triggers.

• Trigger.oldMap: A map of IDs to the old versions of the sObject records. This
map is only available in update and delete triggers.

• Trigger.size: The total number of records in a trigger invocation, both old and
new.

Trigger Context Variables Considerations

• trigger.new and trigger.old cannot be used in Apex DML operations.

• You can use an object to change its own field values using trigger.new, but only
in before triggers. In all after triggers, trigger.new is not saved, so a runtime
exception is thrown.

• trigger.old is always read-only.

• You cannot delete trigger.new.

[6] Difference between trigger.new and trigger.old


Ans: 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, 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.

Quantum Analytics Course Material


[7] Difference between trigger.new and trigger.newMap
Ans: Trigger.new
Returns a list of the new versions of the sObject records. Note that this sObject
list is only available in insert and update triggers, and the records can only be
modified in before triggers.
Trigger.NewMap
A map of IDs to the new versions of the sObject records, this map is only available
in before update, after insert, and after update triggers.
suppose you have a custom object Custom_obj__c, Trigger.new means it is a
List<Custom_obj c> = trigger.new
And,
Trigger.newMap means it is a map<Id, Custom_obj c> = trigger.newMap

NOTE : In before insert context your Trigger.NewMap will always be null


because in before context records are not submitted to the database, so the Id
is not generated yet. That's why in before insert we don't use
Trigger.NewMap But in After insert, Id is generated so we can use
Trigger.NewMap
In case of before and after update, the Id has already been generated in the insert
event. So we can use Trigger.NewMap in before and after update.

[8] Difference between tigger.old and trigger.oldMap


Ans: Trigger.old: Returns a list of the old versions of the sObject records.
Note that this sObject list is only available in the update and delete triggers.

Trigger.oldMap: A map of IDs to the old versions of the sObject records.Note


that this map is only available in the update and delete triggers.
suppose you have a custom object Custom_obj__c = trigger.old, Trigger.old
means it is a List<Custom_obj c> = trigger.oldMap
And,

Trigger.oldMap means it is a map<Id, Custom_obj c>

[9] Difference between trigger.newMap and trigger.oldMap


Ans: Trigger.NewMap: Trigger.newMap returns map of new records which
are trying to insert into Database. This is available in Before Insert, Before
Update, After Insert, After Update Triggers and undelete Triggers. This list of
records can only modified in Before triggers.

Trigger.OldMap: Trigger.oldMap returns map of old records which are updated


with new values. These List of records already there in Database. Trigger.oldmap
available in Before update, after update, Before Delete and After Delete triggers.

[10] What is handler and helper in trigger


Ans: To make a trigger logic less, we use handler and helper apex class. This also

Quantum Analytics Course Material


helps to better code
readability and code re-usability.
[11] Best practice of triggers
Ans:
1) One Trigger Per Object
A single Apex Trigger is all you need for one particular object. If you develop
multiple Triggers for a single object, you have no way of controlling the order of
execution if those Triggers can run in the same contexts.

2) Logic-less Triggers
If you write methods in your Triggers, those can’t be exposed for test purposes.
You also can’t expose logic to
be re-used anywhere else in your org.

3) Context-Specific Handler Methods


Create context-specific handler methods in Trigger handlers.

4) Bulkify your Code


Bulkifying Apex code refers to the concept of making sure the code properly
handles more than one record at a time.

5) Avoid SOQL Queries or DML statements inside FOR Loops


An individual Apex request gets a maximum of 100 SOQL queries before
exceeding that governor limit. So if this trigger is invoked by a batch of more than
100 Account records, the governor limit will throw a runtime exception

6) Using Collections, Streamlining Queries, and Efficient For Loops


It is important to use Apex Collections to efficiently query data and store the data
in memory. A combination of using collections and streamlining SOQL queries
can substantially help writing efficient Apex code and avoid governor limits

7) Querying Large Data Sets


The total number of records that can be returned by SOQL queries in a request is
50,000. If returning a large set of queries causes you to exceed your heap limit,
then a SOQL query for loop must be used instead. It can process multiple batches
of records through the use of internal calls to query and queryMore.

8) Use @future Appropriately


It is critical to write your Apex code to efficiently handle bulk or many records at
a time. This is also true for asynchronous Apex methods (those annotated with
the @future keyword). The differences between synchronous and asynchronous
Apex can be found.

9) Avoid Hardcoding IDs


When deploying Apex code between sandbox and production environments, or

Quantum Analytics Course Material


installing Force.com AppExchange packages, it is essential to avoid hardcoding
IDs in the Apex code. By doing so, if the record IDs change between
environments, the logic can dynamically identify the proper data to operate
against and not fail.

Few more Best Practices for Triggers


There should only be one trigger for each object.
Avoid complex logic in triggers. To simplify testing and resuse, triggers should
delegate to Apex classes which contain the actual execution logic. See Mike
Leach's excellent trigger template for more info.
Bulkify any "helper" classes and/or methods.
Trigers should be "bulkified" and be able to process up to 200 records for each
call.
Execute DML statements using collections instead of individual records per DML
statement.
Use Collections in SOQL "WHERE" clauses to retrieve all records back in single
query
Use a consistent naming convention including the object name (e.g.,
AccountTrigger)

[12] What is recursive trigger ? How to avoid it.


Ans: Recursion occurs when same code is executed again and again. It can lead
to infinite loop and which can result to governor limit sometime. Sometime it can
also result in unexpected output.
OR
When a trigger calls to itself again and again, then this concept is known as trigger
(In this case: trigger calls itself at 16 Times and then throw recursion exception).
To avoid recursion, use a static Boolean flag variable. Example :
public class RecursiveTriggerHandler{
public static Boolean isFirstTime = true;
}

trigger SampleTrigger on Contact (after update){ Set<String> accIdSet = new


Set<String>();
if(RecursiveTriggerHandler.isFirstTime){ RecursiveTriggerHandler.isFirstTime
= false;

Contact c = new Contact();


c.LastName = ‘Disney’;
insert c;
}

// Use accIdSet in some way


}
}

Quantum Analytics Course Material


13] What is order of execution in salesforce
Ans: When you save a record with an insert, update, or upsert statement,
Salesforce performs the following events in order.
• The original record is loaded from the database.
• System Validation Rules.
• Executes all before triggers.
• Custom Validation rules.
• Executes duplicate rules.
• Saves the record to the database, but doesn’t commit yet.
• Executes all after triggers.
• Executes assignment rules.
• Executes auto-response rules.
• Executes workflow rules.
• If there are workflow field updates, updates the record again.
• If the record was updated with workflow field updates, fires before and after
triggers one more time.
Custom validation rules, duplicate rules, and escalation rules are not run again.
• Executes processes and flows launched via processes and flow trigger workflow
actions.
• Executes escalation rules.
• Executes entitlement rules.
• If the record contains a roll-up summary field or is part of a cross-object
workflow, performs calculations and updates the roll-up summary field in the
parent record. Parent record goes through save procedure.
• If the parent record is updated, and a grandparent record contains a roll-up
summary field or is part of a cross-object workflow, performs calculations and
updates the roll-up summary field in the grandparent record. Grandparent record
goes through save procedure.

• Executes Criteria Based Sharing evaluation.


• Commits all DML operations to the database.
• Executes post-commit logic, such as sending email.

Work on All following triggers for better practice :

Scenario 1 : When we are trying to insert new record into object. If there is any
record existing with same account name it should prevent duplicate record.

Scenario 2: Write a trigger to prefix Account Name with ‘Mr’ when new record
is inserted.

Scenario 3: Whenever a new record is created into account object . Before this
new record is inserted into
Account, delete all the contacts records with this account name.

Quantum Analytics Course Material


Scenario 4: Whenever a new transaction is performed successfully then update
the customer object balance field based on
If Transaction Type=Deposit, Balance= balance +amount ; withdraw balance=
balance-amount; Note: Customers and Transaction has lookup Detail Relation.

Scenario 5: Whenever a new contact is created for account update the


corresponding account phone with the new contact phone field.

Scenario 6: Whenever customer record is updated, before updating the record


create new record in test object with old values of customer record.

Scenario 7: To update the owner of a case based on the values selected within a
picklist and populate the owner field with the created by field data. When we have
selected any Field name=Status
Picklist Values= priced-(Initial) Priced-(Re-priced) Price(File Loaded)

Scenario 8: Write a trigger that will prevent a user from creating a lead that
already exists as a contact. We will use the lead /contact email address to detect
duplicates.
Lead is created or updated.
1. Lead has an email address.
2. 2. Try to find a matching contact based on email address.(Using SOQL)
3. If a match is found give an error
4. If a match is not found do nothing.

Scenario 9: When we are trying to delete customer record delete all the
corresponding child records from test object, where customer is lookup field in
the object.

Scenario 10: When we create the opportunity with probability =50% then the
opportunity owner will be automatically added to Account Team of the associated
account for the opportunity.

Scenario 11: Invoking the apex class from the trigger. Whenevr new customers
record is created /updated then income tax should be calculated based on salary
and should be updated to field income tax (Currency field).

Scenario 12: If we delete any of the existing customer record then first create new
test object record with customer record values then delete customer record.

Scenario 13: Whenever we try to update the phone of account record then update
the related contact phone number with the new Account phone number before
account record is updated.
When we delete the account record then delete the corresponding contact records.

Quantum Analytics Course Material


Scenario 14: Suppose there is scenario where one trigger perform update
operation, which results in invocation of second trigger and the update
operation in second trigger acts as triggering criteria for tri gger one.

Scenario 15: Write a trigger which shows recursive trigger


error.

Scenario 16: Create ‘Sales Rep’ field with datatype (Text) on the account
object. When we create account record, the account owner will be
automatically added to Sales Rep field. When we update the Account
owner of the record, then also the Sales Rep Will be automatically
updated.

Scenario 17: Create the field Called ‘Contact Relationship’ checkbox


on the contact object and create the object called “Contact Relationship”
which is related list to the contact.(Lookup Relationship).
Now logic is when we create Contact by checking Contact Relationship
checkbox then contact relationship will be created automatically for that
contact.

Scenario 18: When we change the owner of the Contact Relationship,


then the owner name will be automatically populated in the Contact
Relationship name field.

Scenario 19: Create the field Called ‘Contact Relationship’ checkbox


on the contact object and create the object called “Contact Relationship”
which is related list to the contact.(Lookup Relationship).
When we delete the contact then contact Relationship will be deleted
automatically.

Scenario 20: Create the field Called ‘Contact Relationship’ checkbox


on the contact object and create the object called “Contact Relationship”
which is related list to the contact.(Lookup Relationship).
When we undelete the contact then contact Relationship will be
Undeleted automatically.

Scenario 21: Create field Called ‘Count of Contacts’ on Account object.


When we add the contacts for that Account then count will populate in
the field on Account details page. When we delete the contacts for that
account then count will update automatically.
Note: The above logic will be applicable when we have lookup
relationship. But when we have the master detail relationship, then we can
create Rollup Summary field to get the count of child records using
“Count” function.

Quantum Analytics Course Material


[22] Can you edit an apex trigger/ apex class in production environment?
Can you edit a Visualforce page in production environment?
Ans: 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.

[23] Where you used a trigger in your


project?
Ans: Tell appropriate trigger you have written in your
project.

Quantum Analytics Course Material


Quantum Analytics Course Material

Batch Apex Class in Salesforce

[1] What is batch apex class?


Ans: By using Batch apex classes we can process the records in batches in asynchronously. If you have a large
number of records to process, for example, for data cleansing or archiving, batch Apex is your solution.

The execution logic of the batch class is called once for each batch of records. The default batch size is 200
records.
You can also specify a custom batch size. Furthermore, each batch execution is considered a discrete
transaction.

With each new batch of records, a new set of governor limits is in effect. In this way, it’s easier to ensure that
your code stays within the governor execution limits.

Another benefit of discrete batch transactions is to allow for partial processing of a batch of records in case
one batch fails to process successfully, all other batch transactions aren’t affected and aren’t rolled back if they
were processed successfully.

[2] Syntax of batch apex class


Ans:

global Class cleanup implements Database.Batchable<SBbject> {

global Database.Querylocatorstart(Database.BatchableContext BC){


}

global void execute(Database.BatchableContext BC,List){


}

global void Finish(Database.BatchableContext BC){


}

[3] What is Database.Batchable interface?


Ans: The class that implements this interface can be executed as a batch Apex job.

[4] What are three methods of Database.Batchable<SObject> interface


Ans:
Start:
global Database.Querylocator start (Database.BatchableContext bc){}

Execute:
global void execute(Database.BatchableContext bc,List <p>){}

Finish:
global void finish(Database.BatchableContext bc) {}

[5] What is purpose of start method in batch apex?


Ans: It collect the records or objects to be passed to the interface method execute.

[6] What is the Database.QueryLocator?


Ans: If we use a Database.QueryLocator, the governor limit for the total number of records retrieved by SOQL
queries is bypassed. (Default 50,000 It allow up to 50 million records).

Quantum Analytics Course Material


[7] What is the iterable<Sobject>?
Ans: If you use an iterable, the governor limit for the total number of records retrieved by SOQL queries is still
enforced.

[8] What is the use of execute method?


Ans: Contains or calls the main execution logic for the batch job.

[9] How many times execute method is called?


Ans: Execute method is called for each batch of records. (Number of total record / batch size).

[10] What is the scope of execute method?


Ans: The maximum value for the optional scope parameter is 2,000

[11] What is the maximum size of the batch and minimum size of the batch ?
Ans: The default batch size is 200 records. Min=01, max=2000

[12] What is the Database.BatchableContext?


Ans: BatchableContext Interface is Represents the parameter type of a batch job method and
contains the batch job ID. This interface is implemented internally by Apex.

[13] How to track the details of the current running Batch using BatchableContext?
Ans: You can check the AsyncApexJob.Status using the JobId from the Database.BatchableContext.

[14] How many batch jobs can be added to queue?


Ans: Queued counts toward the limit of 5.

[15] Where do you used batch apex class in your project


Ans: Tell them the batch class implemented in you project.
OR
We have implemented a batch class to send email update to bulk Agents regarding to their commission on 01st
Day of every month.

[16] Difference between insert and Database.insert Or update and Database.update


Ans:
Insert
Insert is a DML statement which is same as Database.insert to insert the record in database. If we use insert
DML statement in bulk operation if error occurs in this operation, then execution stop and rollback all the
insertion from the database those has been inserted successfully. When error occurs then you can handle this
error by try catch block.

Database.Insert
If we use DML database method (Database.insert) to insert/update record in bulk, then if error occurs the
remaining records will be inserted/updated means partially operation will be done.

Just take an Example:

If you are inserting 4 records.


2 having all the required fields value and remaining 2 records missing required fields value.
if you use
Database.insert(list) will throw an exception and it will not insert any one of the records.

But
if you use Database.insert(list, false) It will insert 2 records successfully and rest 2 records (required fields
missing) will not be inserted.
Database.insert(list, false) In this scenario you will not get any exception

Quantum Analytics Course Material


[17] Suppose, finish method is blank, though is it important to write finish
method OR
If I don’t want to write finish method, is it possible?
Ans : Yes, we have to implement/write a finish method though it is blank. (Whenever we implement an interface,
then we have to compulsorily implement all its method, so finish method is of
Database.Batchable<Sobject> interface).

[18] How to execute a batch class


Ans: BatchClassName obj = new BatchClassName();
Database.executeBatch(obj);
OR
Database.executeBatch(obj, 500);

[19] What is use of Database.BatchableContext within the method


Ans: Represents the parameter type of a batch job method and contains the batch job ID. This interface is
implemented internally by Apex.

[20] Can we call callouts from batch


apex? Ans: Yes we can call.

[21] Can we call another batch apex from batch apex?


Ans: Yes you can call a batch apex from another batch apex .Either in start method or in finish method you
can call other batch

[22] How many callouts we can call in batch apex?


Ans: Batch executions are limited to one callout per execution.

[23] Batch is synchronous or Asynchronous operations?


Ans: Asynchronous operations.

[24] If I am inserting two record of the Account. I want a list of successful and failure records, how to
do that.
Ans:

// Create two accounts, one of which is missing a required


field Account[] accts = new List<Account>{
new Account(Name='Account1'),
new Account()};
Database.SaveResult[] srList = Database.insert(accts, false);

// Iterate through each returned


result for (Database.SaveResult sr :
srList) {
if (sr.isSuccess()) {
// Operation was successful, so get the ID of the record that was processed
System.debug('Successfully inserted account. Account ID: ' + sr.getId());
}
else {
// Operation failed, so get all errors
for(Database.Error err :
sr.getErrors()) {
System.debug('The following error has occurred.');
System.debug(err.getStatusCode() + ': ' + err.getMessage());
System.debug('Account fields that affected this error: ' +
err.getFields());
}
}
}

Quantum Analytics Course Material


[25] What is batch chaining
Ans: Calling one batch class from finish method of another batch class is known as Batch Chaining.

[26] How many active batch classes can be there in queue.


Ans: 05

[27] Write a batch apex class to prefix Mr or Ms. as per Gender of the existing customer record (05 Lac).
Show successful and failure customer Ids.

[28] How to schedule a batch class


Ans: Write a schedulable class and from its execute method, call batch class
Example
ScheduleClass implements Schedulable{

public void execute(SchedulableContext SC){


BatchClassName obj = new BatchClassName()
Database.executeBatch(obj);
}
}
[29] In how many ways can we schedule a class? Which are they?
Ans:
Using Configuration: Go to Apex Class -> Schedule Apex Class

Using Customization : Using cron object:

ScheduleClass obj = new ScheduleClass ();


String cronStr = '0 0,30 * * * *';
System.schedule('Process Accs Job', cronStr, obj);

[30] What is cron object and meaning of cron object expression?


Ans: CRON expression we can schedule an apex with our customized date time or occurrence through code

0 0 5 ? * 1,2,3,4,5,6,7
{1} {2} {3} {4} {5} {6}

{1} Seconds - so 0 here i.e. start of the minute.

{2} Minutes - 0 again so start of the hour.

{3} Hours - 5 so 5 am. Uses 24 hour notation so 21 = 9pm

{4} Day_of_month - ? means no specific value, only available for day of the month and day of the week.

{5} Month - * indicates all values, i.e. every month. (if we only want to run on 1st Jan say, this would be 1)

{6} Day_of_week - 1,2,3,4,5,6,7 here specifies days 1,2,3,4,5,6,7 in the week. We could also write this string as
MON-FRI or preferably as * to indicate all values.

So this job reads to run at "0 seconds past 0 minutes of the 5th hour on no specified day of the month for
every month of the year for every day of the week".

[31] What will be con object expression, if I want to schedule an apex class on 15th May 2020 at 03:00 PM.
Ans : String cronExp ='0 0 15 15 5 ? 2020'

[] What will be con object expression, if I want to schedule an apex class on 01st DAY of every month
at12:00 AM.
Ans: String cronExp ='0 0 0 1 * ? *';

Quantum Analytics Course Material


[32] How to Execute the Batch Apex Class for Every 30 minutes?
Ans: batchApexMethod exeClass = new batchApexMethod();
String cronStr = '0 0,30 * * * *';
System.schedule('Process Accs Job', cronStr, exeClass);

[33] From where to see scheduled apex job and delete a scheduled job
Ans: Scheduled Jobs

[34] What is AsyncApexJob class


Ans: In Salesforce, records in the 'AsyncApexJob' table represents Apex jobs to run asynchronously when
resources are available.

[35] What is Database.State full interface?


Ans: To maintain variable value inside the Batch class, Database.Stateful is used.

[36] Is it possible to call future method from apex scheduler or not?


Ans: Yes
//Scheduled Apex
public class DemoScheduler1 implements Schedulable{
public void execute(SchedulableContext sc){
system.debug('*******Going to call future method ');
DemoAsynchronousTest.futureMethodCallFromScheduler();
}
}
//apex class containing future method
public class DemoAsynchronousTest{
@future
public static void futureMethodCallFromScheduler(){
system.debug('******futureMethodCallFromScheduler get called');
}

Quantum Analytics Course Material


[37] Is it possible to do Synchronous Web service callouts from scheduled apex?
Ans: No.
Synchronous Web service callouts are not supported from scheduled Apex. To be able to make callouts, make
an asynchronous callout by placing the callout in a method annotated with @future(callout=true) and call this
method from scheduled Apex. However, if your scheduled Apex executes a batch job, callouts are supported
from the batch class.

[38] Can we call scheduler from future method?


Ans: Yes

[39] Is there is any way through which we can call future method from batch apex?
Ans: As we know that a webservice can be called from batch class and webservice can call @future method. So
in your batch class call webservice and which can call your @future method.
Also you can call future method from finish method in batch class.

[40] What all different things which we need to consider while using future methods?
Ans:
1. Methods with the future annotation cannot be used in Visualforce controllers in either
getMethodName or setMethodName methods, nor in the constructor.
2. You cannot call a method annotated with future from a method that also has the future
annotation. Nor can you call a trigger from an annotated method that calls another annotated method.
3. Future methods cannot be called from batch class.

[41] Can we modify the scheduler class or classes referenced by this scheduler class if any scheduled job is
pending?
Ans: No
If there are one or more active scheduled jobs for an Apex class, you cannot update the class or any classes
referenced by this class through the Salesforce user interface. However, you can enable deployments to
update the class with active scheduled jobs by using the Metadata API.

[42] What we can do if we have to deploy the scheduler class or classes referenced by this scheduler class if
any scheduled job is pending for that scheduler class in target org?
Ans: By default, changes to Apex code that have Apex jobs pending or in progress can’t be deployed. To deploy
these changes, do one of the following.
• Cancel Apex jobs before deploying changes to Apex code. Reschedule the jobs after
the deployment.
• Enable deployments with Apex jobs in the Salesforce user interface in the Deployment Settings page.

[43] What is Database.AllowCallouts?


Ans:
• To use a callout in batch Apex, you must specify Database.AllowsCallouts in the class definition. For
example:
global class SearchAndReplace implements Database.Batchable<sObject>,
Database.AllowsCallouts{
//Business logic you want by implementing Batchable interface methods
}

Callouts include HTTP requests as well as methods defined with the webService keyword.

[44] When a BatchApexworker record is created?


Ans:
• Ans: For each 10,000 AsyncApexJob records, Apex creates one additional AsyncApexJob record of
type BatchApexWorker for internal use.

Quantum Analytics Course Material


Quantum Analytics Course Material
Test Classes in Salesforce

1. What is an apex Unit Testing Or what is a test class? Why we need to write Test classes?
Ans: A test class is a class which helps in checking the quality of code before it can be deployed to Salesforce
Production. It helps in code coverage of an Apex class or Trigger.

2. What is @isTest annotation? When you will use it?


Ans: When you define method or class using @isTest annotation then it only contains code used for testing your
application. Test classes should be public or private only. Test class doesn't count against your organization limit
of 3 MB for all Apex code.

3. How to run a test method


Ans: Go to quick find box -> Apex Test Execution -> Select test class

4. What is a test Setup Method in a test class


Ans: For example, we have a test class, It has two test methods and each test method required 5
account records. So without creating 5 records for each test method, we will create a new method with
annotation
@testSetup then create only 5 account records. These records can access all test methods using SOQL query
in that test class.
@testSetup static void setup() {
// Create common test accounts
List<Account> accountsLst = new List<Account>();
for(Integer i=0;i<5;i++) {
testAccts.add(new Account(Name = 'TestAc '+i));
}
Insert accountsLst;
}

Thinks to remember when you use @testSetup method:


▪ We can use only one test setup method per class.
▪ Test setup method will execute first in the test class.
▪ If any DML error occurs in this test setup method, rest of the method not executed.
▪ If a test setup method calls a non-test method of another class, no code coverage is calculated for the
non-test method.

5. how is a test method defined?


Ans: A test method is defined as mentioned below:-
Syntax:
static testMethod void testMethodName(){
….. Your Code here ……..
}
OR
@isTest
static void testMethodName(){
….. Your Code here ……..
}

6. What are the things to remember when we use @testSetup method?


Ans: All database changes are rolled back at the end of a test. We can’t use this method on records that
existed before the test executed. We also can’t use setCreatedDate in
methods annotated with
@isTest(SeeAllData=true), because those methods have access to all data in the org. The both parameters (Id
recordId, Datetime createdDatetime) of this method are mandatory.

Quantum Analytics Course Material


7. How many types of Assert Statements are there and what is their purpose?
Ans: Assert statements are used to compare expected value with the actual
value.
There are three types of assert statements :
1. assertEquals(expVal, actVal); returns true if expVal Matches actVal.
2. assertNotEqual(expVal, actVal); returns true if expVal does not match actVal.
3. assertEquals(expVal > actVal); returns true if the condition is satisfied.

8. Best practices of test


class
An
s:
a)Do not put (seeAllData = true) in test class otherwise, use it for exceptional cases.
b)Use @isTest at the Top for all the test classes.
c)Test in bulk: Test to see if your code can run on 200 records at once. This is the maximum number
of records that can be evaluated in a single trigger by Salesforce. Don’t worry about this one too much
for now, since we’ll be talking more about it in our Governor Limits chapter! It’s possible that your
code runs fine if a single Contact goes through your trigger – but it might break if 200 Contacts are
evaluated in your trigger!
d) Avoid Using Hard Coding Ids anywhere in test Class or any Salesforce apex class.
e) Use System.runAs() method to test the functionality in user Context.
f) Use System.assertEquals() to see if your code has the expected outcomes
g) Use Test.startTest() and Test.stopTest() statement to increase Governor Limits of your test code

9. What is Test.startTest() and Test.stopTest()? When you will use


it?
Ans: Test.startTest() and Test.stopTest() allow you to reset the governor limits within the context of your test
execution and testing asynchronous classes. When Test.startTest() begins all the governor limits will be
reset. and Test.stopTest() to end the execution of asynchronous process and switch back to the main context.

Points to remember when you use Test.startTest() and Test.stopTest()


methos.
a) These two methods we can use only once in test method.
b) It's not mandatory to use in every test method, but we can use some situations like testing
Asynchronous classes.

10. How to test a private method of an apex


class?
O
R
What is @testVisible annotation? When you will use
it?
Ans: Consider, If you have an Apex class or controller, It has a Private or Protected variable or methods or
inner classes. so you can't access them in other classes. But using this @testVisible annotation in a Private or
Protected variable or methods or inner classes safely expose them only for test classes.

11. What is Mixed DML statement error and how to avoid


it
Ans: If we use setup object and non-setup object in the same transaction, then salesforce gives mixed
DML statement error.
O
R
DML operations on certain sObjects, sometimes referred to as setup objects, can’t be mixed with DML on
other sObjects in the same transaction. This restriction exists because some sObjects affect the user’s access to
records in the org. You must insert or update these types of sObjects in a different transaction to prevent
operations from happening with incorrect access-level permissions. For example, you can’t update an account
and a user role in a single transaction.

Quantum Analytics Course Material


To avoid this error, we should perform DML operation on non-setup object records in a different
transaction.

Exampl
e:
@isTe
st
private class MixedDML
{
static testMethod void mixedDMLExample()
{ User u;
Account a;
User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
// Insert account as current user
System.runAs (thisUser) {
Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
UserRole r = [SELECT Id FROM UserRole WHERE Name='COO'];
u = new User(alias = 'jsmith', email='[email protected]',
emailencodingkey='UTF-8', lastname='Smith',
languagelocalekey='en_US',
localesidkey='en_US', profileid = p.Id, userroleid = r.Id,
timezonesidkey='America/Los_Angeles', username='[email protected]');
insert u;
a = new Account(name='Acme');
insert a;
}
}
}

Above code will give MIXED DML Statement error. To


avoid this, do following,

public class InsertFutureUser {


@future
public static void insertUser() {
Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
UserRole r = [SELECT Id FROM UserRole WHERE Name='COO'];
User futureUser = new User(firstname = 'Future', lastname = 'User',
alias = 'future', defaultgroupnotificationfrequency = 'N',
digestfrequency = 'N', email = '[email protected]',
emailencodingkey = 'UTF-8', languagelocalekey='en_US',
localesidkey='en_US', profileid = p.Id,
timezonesidkey = 'America/Los_Angeles', username
= '[email protected]',
userpermissionsmarketinguser = false,
userpermissionsofflineuser = false, userroleid = r.Id);
insert(futureUser);
}
}

@isTest
public class UserAndContactTest {
public testmethod static void testUserAndContact() {
InsertFutureUser.insertUser();
Contact currentContact = new Contact(
firstName = String.valueOf(System.currentTimeMillis()),
lastName = 'Contact');
insert(currentContact);

Quantum Analytics Course Material


}
}

12. Tell us some Setup object name


Ans:
▪ ObjectPermissions
▪ PermissionSet
▪ PermissionSetAssignment
▪ QueueSObject
▪ ObjectTerritory2AssignmentRule
▪ ObjectTerritory2AssignmentRuleItem
▪ RuleTerritory2Association
▪ SetupEntityAccess
▪ Territory2
▪ Territory2Model
▪ UserTerritory2Association
▪ User

13. What is a System.runAs? When you will use


it?
Ans: Generally, all Apex code runs in system mode, where the permissions and record sharing of the
current user are not taken into account. The system method runAs enables you to write test methods that
change the user context to an existing user or a new user so that the user’s record sharing is enforced. The
runAs method doesn’t enforce user permissions or field-level permissions, only record sharing.

You can use runAs only in test methods. The original system context is started again after all runAs test
methods complete. The runAs method ignores user license limits. You can create new users with runAs
even if your organization has no additional user licenses.

14. Can we use system.run as in all the


methods?
Ans: System.runAs() must be used only in a test
method

15. What is seeAllData and why it is recommended to avoid using


it?
Ans: test classes run in a different context, i.e. a test class have no idea about the data stored in Salesforce,
by
setting seeAllData=true => @isTest(seeAllData =
true).

Enabling this attribute exposes the data from the database to the test
class.

It is recommended not to use as the code coverage of you apex class or trigger will now be dependent on
the data which is present in org and depending upon that the code coverage may change.

But some objects we can't create a data for testing. for example Profiles. we can't create profiles in test
classes. so we will query the profiles and assign to users.
@isTest (SeeAllData =
true)

16. What is code coverage and how it is


counted?
Ans: Code Coverage is the percentage number of lines covered by the test class by a total number of lines
need
to be
covered.

Minimum code coverage for the trigger is at least 1% and for class, the overall code coverage of

Quantum Analytics Course Material


production should be above 75% before a new component can be deployed to the production.

17. What is test data factory


class
Ans: Common test utility classes are public test classes that contain reusable code for test data
creation.The
TestDataFactory/ testutility class is a special type of class — It is a public class that is annotated with
@isTest and and as such, are excluded from the organization code size limit and execute in test context and
can be accessed only from a running test.

Test utility classes/TestDataFactory contain methods that can be called by test methods to perform useful tasks,
such as setting up test data.

18. What to Test In


Apex?
Ans: Salesforce.com recommends the following components need to
test.

1. Single
Records:
This includes testing to verify that a single record produces the correct,
expected result
2. Bulk
Records:
Any apex code, whether a triggers, a class or on extension may be
used
for 1to 200 records we must test not only the single record case, but the
bulk cases as well.
3. Positive
scenarios:
This type of component testing expect a system to save a record without
error.
4. Negative
scenarios:
This type of component testing expect a system to give error.
5. Restricted User:
Test whether a user with restricted access to the objects used in code sees the
expected behavior, i.e whether they can run the code or receive error messages.

19. How is code coverage calculated?


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

Note: Comments blank lines,System.debug() statements and curly brackets are excluded.

Multiple statements on one line are counted as one line for the purpose of code coverage.

20. What is a Test.setCreatedDate? When you will use it?


Ans: Sometimes we need test data like record created date in past. So we will use Test.setCreatedDate to set
the created date meet our requirements. It only used in test classes.

Example :

Account ac = new Account(name='test


ac'); Insert ac;
Test.setCreatedDate(ac.Id, DateTime.newInstance(2015,01,01));

21. Which Objects can we access without using seeAllData=true?


Ans: We use seeAllData = true to get real-time data in test class, but without using this also you can get the
data from following objects.

Quantum Analytics Course Material


User, profile, organization, AsyncApexjob, Corntrigger, RecordType, ApexClass, ApexComponent , ApexPage
and custom metadata types.

22. Does Salesforce count calls to system.debug() against the code coverage?
Ans: No, Salesforce does not count it against the code coverage.

23. Which classes are excluded from code coverage calculation?


Ans: Test classes (classes that are annotated with @isTest) are excluded from the code coverage calculation.

24. Where the code coverage is stored?


Ans: Code coverage is stored in two Lightning Platform Tooling API objects:

ApexCodeCoverageAggregate:
It stores the sum of covered lines for a class after checking all test methods that test it

ApexCodeCoverage:
Stores the lines that are covered and uncovered by each individual test method.

25. How to retrieve code coverage information?


Ans: We can query these objects by using SOQL and the Tooling API to retrieve coverage information.
Using SOQL queries with Tooling API is an alternative way of checking code coverage and a quick way to get
more detail.

26. Why code coverage differs between sandbox and production?


Ans: Sandbox and production environments often don’t contain the same data and metadata, so the
code coverage results don’t always match.

27. What is OnInstall = true notation?


Ans: Use the @IsTest(OnInstall=true) annotation to specify which Apex tests are executed during package
installation. This annotation is used for tests in managed or unmanaged packages.
28. What is (isParallel=true)?
Ans: Use the @isTest(isParallel=true) annotation to indicate test classes that can run in parallel. Default limits
on the number of concurrent tests do not apply to these test classes.

29. Can we use (SeeAllData=true) and (isParallel=true) in same apex test method?
Ans: @isTest(SeeAllData=true) and @isTest(isParallel=true) annotations cannot be used together on the
same Apex test method.

30. What is a test.isrunningtest()? When you will use it?


Ans: The Test.isRunningTest() method is used to identify, if the piece of code being executed is invoked from a
Test class execution or from other artefacts such as a Trigger, Batch Job etc. Returns true if the code
being executed is invoked from a test class otherwise returns a false.

Example:
Performing web service callouts in Apex are not supported within Test Code. Hence we could use the
Test.isRunningTest() to conditionally identify and route the execution of a code block that calls the Test
Mock framework to simulate a mock, callout response.

31. Use Case of Test.isRunningTest() method

When we are setting up test data from Apex test method, we need a way to disable the triggers that will fire. It
might cause “LimitException: “Too many SOQL queries: 101″. In this case, the triggers are not the target of the
test case, hence this scenario will cause the test method to fail. It is not necessary to disable the trigger for
every test case, instead we can use isRunningTest().

Setup up the trigger by leveraging isRunningTest(). isRunningTest() – Returns true, if the currently executing
code was called by code contained in a test method, false otherwise. Use this method if we need to run
different code depending on whether it was being called from a test.

Other Usage scenarios

Quantum Analytics Course Material


1. To ensure the trigger doesn’t execute the batch if Test.IsRunningTest() is true, and then test the batch class
with it’s own test method.

2. Testing callouts – in our callout code we check to see if we‘re executing within a unit test context by
checking Test.isRunningTest() and instead of getting your callout response from an HttpResponse.send()
request, you return a pre-built test string instead.

32. How to test asynchronous callout?


Ans: Because Apex tests don’t support making callouts, we can simulate callout requests and responses.
When we are simulating a callout, the request doesn’t get sent to the external service, and a mock response is
used.

To simulate callouts in continuations, call these methods of the Test class:


Test.setContinuationResponse sets a mock response, and
Test.invokeContinuationMethod causes the callback method for the
continuation to be executed.

33. How to test a Web Service Callouts?


Ans: By default, test methods don’t support web service callouts, and tests that perform web service callouts
fail. To prevent tests from failing and to increase code coverage, Apex provides the built-
in WebServiceMockinterface and the Test.setMock method.

When we create an Apex class from a WSDL, the methods in the auto-generated class call
WebServiceCallout.invoke, which performs the callout to the external service. When testing these methods, we
can instruct the Apex runtime to generate a fake response whenever WebServiceCallout.invoke is called. To
do so, implement the WebServiceMock interface and specify a fake response for the Apex runtime to send

34. How to test future method?


Ans: To test future methods make our call to any future method between Test.startTest(); and Test.stopTest();
statements and the future method will return when Test.stopTest(); is called.

35. What is a good practice of testing Batch class?


Ans: We should always test batch class with good amount of data (minimum 200 records) in our test class.
Use Test.startTest() and Test.stopTest() to test batchable classes.

Quantum Analytics Course Material


Quantum Analytics Course Material
Sandbox in Salesforce

1. What is a sandbox and why it is needed?


Ans- A sandbox is an isolated testing environment that enables users to run programs or
execute files without affecting the application, system or platform on which they run. Software
developers use sandboxes to test new programming code.

2. What are various types of sandboxes in salesforce?


Ans-
Developer Sandbox
A Developer sandbox is intended for development and testing in an isolated environment. A
Developer Sandbox includes a copy of your production org’s configuration (metadata).
Developer Pro Sandbox
A Developer Pro sandbox is intended for development and testing in an isolated environment and
can host larger data sets than a Developer sandbox. A Developer Pro sandbox includes a
copy of your production org’s configuration (metadata). Use a Developer Pro sandbox to
handle more development and quality assurance tasks and for integration testing or user
training.
Partial Copy Sandbox
A Partial Copy sandbox is intended to be used as a testing environment. This environment
includes a copy of your production org’s configuration (metadata) and a sample of your
production org’s data as defined by a sandbox template. Use a Partial Copy sandbox for quality
assurance tasks such as user acceptance testing, integration testing, and training.
Full Sandbox
A Full sandbox is intended to be used as a testing environment. Only Full sandboxes support
performance testing, load testing, and staging. Full sandboxes are a replica of your production
org, including all data, such as object records and attachments, and metadata. The length of
the refresh interval makes it difficult to use Full sandboxes for development.

3. Which sandbox have you used for your development?


Ans- Developer Pro Common developer sandbox (depends on which you have used in
reality. It may be your developer sandbox).

4. So, if your team uses a common sandbox for development purpose, then what if two or
more members wants to work on same visualforce page.
Ans- Team lead handles this situation to which developer will work on which component. And
all the developer has updates of development on a sheet or outlook.

5. Have you ever used changeset for deployment?


Ans- Yes, we frequently use changeset. It is easier.

6. Can we deploy just a profile using changeset?


Ans- No, we can not deploy just a profile using changeset.
We need to add at least one component in the changeset, then only we can deploy.
OR
It's not possible to upload a change set containing only profiles so you'll need to make sure that
a component is also included. Profiles are not officially supported as individual components in
change sets as per the Components Available in Change Sets documentation. Although profiles

Quantum Analytics Course Material


are available and can be selected with other components, there are limitations on what specific
parts of the profile's permissions can be deployed via change sets.
7. What is the difference between partial copy and full copy sandbox?
Ans- Refer question number 2.

8. Which tool have you used for component deployment?


Ans- Changeset and Force IDE (Eclipse) (Tell them ANT and salesforce packages if you are
comfortable).
9. Can you edit an apex trigger/ apex class in production environment? Can you edit a
Visualforce page in production environment?
Ans-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.

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


Ans- You can deploy code in Salesforce using:

A. Change Sets
B. Eclipse with Force.com IDE
C. Force.com Migration Tool – ANT/Java based
D. Salesforce Package

11. What do you mean by outbound changeset and inbound changeset?


Ans- An outbound change set is a change set created in the Salesforce org in which you are
logged in and that you want to send to another org. You typically use an outbound change set
for customizations created and tested in a sandbox and that are then sent to a production org.
An Outbound changeset created on source org side.

An inbound changeset is a change set created to receive the component from outbound
changeset. An Inbound changeset created on destination org side.

12. I have created a new outbound changeset but not able to deploy in another sandbox or
production (option is not available). What should I do?
Ans- Go to destination org -> Deployment Setting -> Select org -> Allow Inbound Changes

13. Difference between Run local test and run all test.
Ans- Run local tests - All tests in your organization are run, except the ones that originate from
installed managed packages. This test level is the default for production deployments that
include Apex classes or triggers.

Run all tests - All tests in your organization are run, including tests of managed packages.

14. My first outbound changeset failed. Now I want to add dependent component in the
existing changeset. How can we do it.
Ans- Clone first outbound changeset and then add more components.

Quantum Analytics Course Material


15. What is a workbench?
Ans - Workbench is a web-based tool which helps administrators and developers to interact
with Salesforce for Data Insert, Update, Upsert, Delete and Export. It also supports the Undelete
Program, Deploy, Retrieve, Rest Explorer and Apex Execute actions too.

16. Have you ever used workbench in your project? Why?


Ans – Yes, for SOQL purpose and updating the record.

17. Have younever deployed any component from developer sandbox to production?
Ans – No, there was a special deployment team to handle this. Development team creates a
outbound changeset and tells us to add our component in it. (You can give answer according to
your understanding).

Quantum Analytics Course Material

You might also like