Interview Ques
Interview Ques
Interview Ques
Salesforce.com is cloud
computing company
which
is
based
in San
Francisco, USA. It offers business software on a subscription basis. Salesforce also
hosts the application offsite and it is popular for its Customer Relationship
Managementproducts.
The company was founded by Marc Benioff, a former Oracle executive, Parker
Harris,Dave Moellenhoff and Frank Dominguez in March 1999. This company
then specializes in software as a service. The company went public in June 2004
on theNew York Stock Exchange under the stock symbol CRM.
salesforce.com is all about CRM. It's a site that's built for Customer Relationship
Management, this basically means they give you a resource to keep a firm base of
communication and knowledge with your customers that will help you succeed as
well as gain new customers. It is a program and part of a business plan to help you
gain knowledge about your customers and their behaviors and needs that you can
help provide to get a stronger base for your company. It gives you a great
advantage over those companies and businesses that choose not to focus on CRM
and do not keep a tab on customers and what it will take to draw in new ones.
Salesforce is a technology that is basically a cloud computing platform that will
help you with your CRM and budget everything to make your business as
successful as it can possibly be!
Salesforce doesn't perform system validation in this step when the request comes from
other sources, such as an Apex application or a SOAP API call.
Salesforce runs user-defined validation rules if multiline items were created, such as
quote line items and opportunity line items.
3. Executes all before triggers.
4. Runs most system validation steps again, such as verifying that all required fields have a
non-null value, and runs any user-defined validation rules. The only system validation
that Salesforce doesn't run a second time (when the request comes from a standard UI
edit page) is the enforcement of layout-specific rules.
5. Executes duplicate rules. If the duplicate rule identifies the record as a duplicate and uses
the block action, the record is not saved and no further steps, such as after triggers and
workflow rules, are taken.
6. Saves the record to the database, but doesn't commit yet.
7. Executes all after triggers.
8. Executes assignment rules.
9. Executes auto-response rules.
10. Executes workflow rules.
11. If there are workflow field updates, updates the record again.
12. If workflow field updates introduced new duplicate field values, executes duplicate rules
again.
13. If the record was updated with workflow field updates, fires before update triggers and after update triggers one more time (and only one more time), in addition to standard validations. Custom validation rules are not run again.
14. Executes processes.
If there are workflow flow triggers, executes the flows.
Flow trigger workflow actions, formerly available in a pilot program, have been superseded by the Process Builder. Organizations that are using flow trigger workflow actions
2
may continue to create and edit them, but flow trigger workflow actions arent available
for new organizations. For information on enabling the Process Builder in your organization, contact Salesforce.
15. Executes escalation rules.
16. Executes entitlement rules.
17. 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.
18. 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.
19. Executes Criteria Based Sharing evaluation.
20. Commits all DML operations to the database.
21. Executes post-commit logic, such as sending email.
Note
During a recursive save, Salesforce skips steps 8 (assignment rules) through 18 (roll-up
summary field in the grandparent record).
This paved way for a novel kind of CRM - the Cloud based CRM. In any cloud
based CRM, applications are hosted by the vendor and organizations can gain access to data through the web without having to worry about any technical aspects
of managing it.
Cloud CRM has become popular over time upsetting the concept of the on-premise CRM model because there was no software licensing fee involved, the organization did not need dedicated IT staff or infrastructure. This has in turn reduced
the cost of monthly services and eased the set up process.
What is Salesforce CRM?
Organizations were in need of a cloud CRM to deal with all sorts of customer concerns varying from marketing and sales to customer service - to streamline the
enterprise and help in saving valuable resources and time. Salesforce as founded
in 1999 by former Oracle executive Marc Benioff, Parker Harris, Dave Moellenhoff, and Frank Dominguez - with a vision to reinvent the Cloud CRM model
and now, Salesforce defines the new era of cloud computing.
What does Salesforce do?
Salesforce is cloud based CRM software, developed to make organizations function efficiently and profitably by reducing the cost of managing hardware infrastructure. Salesforce offers a wide range of features in all the functional areas of a
company:
Salesforce in Marketing Team: Salesforce professional edition helps the marketing team of a company create and track various marketing campaigns to measure the success rate and automatically provide leads to the sales team of the company.
Salesforce in Customer Support Team: Salesforce also keeps a track of various customer issues and tracks them for resolution based on various escalation
rules such as the importance of the client and elapsed time. This improves customer satisfaction levels as the issues do not fall through loopholes and are directly escalated to the next level.
Salesforce in Training: Salesforce has very robust training and support features that are above industry standards. Salesforce users can easily find answers
to their questions from the extensive online help manual and the video walk facility.
According to Gartner, the overall value of the Global CRM Software Market was
20.4 billion USD by the end of 2013 - which is anticipated to increase by 13.7 %
every year, making the global CRM software market a billion dollar space.
Salesforce is right at the top contributing to 16% of the overall CRM Software market share, making Salesforce and CRM software inseparable.
Yvonne Genovese, Vice President at Gartners Marketing Leaders Research said
Marketing will be the largest growing Salesforce CRM category through 2017.
The International Data Corporation (or IDC) expects the overall market for marketing automation to grow from $3.2 billion in 2010 to $4.8 billion in 2015.
3. STRATEGIC ACQUISITIONS
Salesforce has a smart acquisition policy to increase enhanced capabilities. As part
of their long-term vision, they were successful in numerous strategic acquisitions
from the year 2006. Strategic Acquisitions have helped the Salesforce CRM Software build highly broadened marketing eco system referred to as the Marketing
Cloud.
The most recent strategic acquisition has been that of RelateIQ for $390 million
which helps eliminate manual data entry by automated tracking of relationships
in the CRM space. This will certainly be a critical value addition offering in
Salesforce Marketing Cloud.
Image Credit:http://marketrealist.com/
Image Credit:http://marketrealist.com/
4. HIGHLY DIVERSIFIED OFFERINGS: Salesforce is the innovator of the
SaaS approach in the enterprise space. Its proficiency in on-demand software
helps reduce the cost for customers as it provides a common networking, hardware and software platform. Customers can improve sales and enhance communication through various SaaS offerings of Salesforce namely Salesforce Chatter,
Sales Cloud, and Service Cloud applications.
10
11
To stay tuned with the increasing demand and growing trend, Salesforce launched
Salesforce1 in October 2013- an innovative CRM platform for software vendors,
developers, and customers for connecting applications and third-party services
such as Dropbox, Evernote and LinkedIn.Instant and customized Customer Service, On-Screen guided support and live video support are just some of the remarkable features of Salesforce1 which contribute to its dominance in the CRM
software space.
Salesforce1 has seen significant growth of active mobile application users which
is whopping 96% with 46% increase in the active users for customized mobile applications. Thus, Salesforce1 is successful in leveraging the growth in the Customer Relationship Management Software market by meeting the increasing demand mobile devices service providers.
What the future holds for Salesforce CRM Software?
With different Salesforce reviews on the web, it is palpable that though the cost
for salesforce CRM Software service is more, has the best user-friendly interface
when compared to other CRM softwares such as Siebel, SugarCRM. According to
IDC, the overall Marketing Automation market is poised to touch $5.5 billion in
2016 from $3.7 billion in 2011which presents exceptional growth projections for
Salesforce CRM in the marketing category.
Salesforce is on the brink to provide an array of diversified cloud applications and
services to meet the unquenchable demand for cloud computing. Salesforce Customer Relationship Management software is all set to grow exponentially in the
CRM software market.
13
Standard
Fields
are
pre-defined
in
Salesforce
You cannot delete standard fields but you can remove non-required standard
fields
from
a
page
layout
Standard Field customizations include the ability to change standard field labels
and tabs
You can change the display labels of standard tabs, objects, fields, and other
related user interface labels so they better reflect your organizations
business requirements.
Renamed labels for example, Accounts changed to Companies
display on all user pages, in Outlook Edition, and in Offline Edition.
Its important to note that all pages in the Setup area use the default, original
labels.
14
Reports and views are not renamed based on the new label value.
Custom
Fields
Capture information unique to your business process by creating custom fields
with
custom
field.
Recycle
Bin
for
Deleted
Custom
Fields
Custom fields are deleted permanently after 15 days.
Is it possible to change the existing data types of custom fields, if Yes
please explain?
Yes. Its possible but Changing the data type of an existing custom field can cause
data loss in the following situations:
Changing to or from type Date or Date/Time
Changing to Number from any other type
Changing to Percent from any other type
Changing to Currency from any other type
Changing from Checkbox to any other type
Changing from Picklist (Multi-Select) to any other type
Changing to Picklist (Multi-Select) from any type except Picklist
Changing from Auto Number to any other type
Changing to Auto Number from any type except Text
Changing from Text Area (Long) to any type except Email, Phone, Text, Text
Area, or URL
What is a dependent picklist?
Dependent fields can help make your data more accurate and consistent by
applying
filters.
A dependent field works in conjunction with a controlling field to filter its values.
The value chosen in the controlling field affects the values available in the
dependent
field.
300 is the maximum number of values allowed in a controlling picklist
- A custom multi-select picklist cannot be the controlling field for a dependent
field
Field Type
Controlling
Field
Dependent
Field
15
Standard
Yes
Picklist
Custom Picklist Yes
Custom Multi- No
Select
Standard
Yes
Checkbox
Custom
Yes
Checkbox
No
Yes
Yes
No
No
What are the system fields, audit fields and Standard fields?
System Fields: They are read-only & system generated fields. They are:
Id - Globally unique string that identifies a record.
15 Characters size if you access it inside the salesforce application. For
example, you can see 15 characters ID in the URL when you view the record.
18 Characters size if you access it from outside the salesforce application.
For example, When you use dataloader, or retreive the record from
developer console, etc..
IsDeleted this field is TRUE when the record is deleted or FALSE when the
record is not deleted.
Deleted records, fields, objects can be undeleted within 15 days of time.
Standard objects or Standard fields can NOT be deleted. Only custom fields of
standard object or custom objects can be deleted.
Audit Fields:
CreatedById- ID of the User who created this record.
CreatedDate- Date and time when this record was created. C
LastModifiedById- ID of the User who last updated this record.
LastModifiedDate- Date and time when this record was last modified by a user.
SystemModstamp - Date and time when this record was last modified by a
user or by an
automated process (such as a trigger).
Standard Fields:
ID
Name The field that is created while creating the object. It can be a Text or
16
17
So, the detail object cannot have sharing rules, manual sharing, or queues, as
these require the Owner field.
- Roll-Up Summary field are available for parent object only.
- Standard Object cannot be detail object. You can define master-detail
relationships between custom objects or between a custom object and a standard
object. However, the standard object cannot be child object.
Look up Relationship (one parent many children) :
-Relationship is optional. Child record can be stored without parent record.
- No impact on security. Child record have owner so they can have their own
sharing rules, manual sharing, queues.
Roll-Up Summary fields are not available for lookup relationship.
How many master-detail and lookup relationships we can have on one object?
we can create 2 Master Details and 25 lookups on one object.
Junction Object [Many to Many relationships]: Sometimes we may need
many-to-many relationships, and we can achieve that by having two one to many
relationships. For example one man can go to more than one shop and one Mall
can have more than one shop. Now one to many from man to Shop and another
one to many from mall to shop. So, the shop is junction object.
20
External ID
This is a field that usually references an ID from another (external) system. For
instance, if the customer has an Oracle Financials system that they will be linking
with salesforce.com, it may be easier for them to be able to refer to the Oracle ID
of account records from within salesforce. So they would create an external ID in
salesforce.com and they would load the Oracle ID into that field for each account.
They can then refer to that ID field, rather than the salesforce.com id.
Additionally, if you have an external ID field, the field becomes searchable in the
sidebar search. You also can use the upsert API call with the extenal ID to refer to
records.
You can have multiple records with the same external ID (though it is not
reccomended, as it will defeat the purpose of the external id) .
External Id available for Text, Number and Email field types.
External Id is used in upsert operations.
If external id is absenor not matched then insert happens.
If external id matched once then record will be updated.
If external id is matched multiple times then error occurs.
Unique ID field
This is a setting for the field that will prevent you from using the same value in
multiple records for the unique field. So if I create a 5 character text field and
make it unique, and I create a record with the value 12345 i will not be able to
create another record with that same value in the unique field. If i try to do so, I
will get an error saying that the value is already in use.
Often, External Ids are set with the unique property so that the IDs will be unique
to each record.
21
organization, profile, and user settings for the current user and returns the most
specific, or lowest, value. In the hierarchy, settings for an organization are
overridden by profile settings, which, in turn, are overridden by user settings.
24
If you use this function with a numeric field, the function only returns TRUE
if the field has no value and is not configured to treat blank fields as zeroes.
How many ways we can made field is required?
1. While creation of field
2. Validation rules
3. Page Layout level
What is the maximum size of the PDF generated on visualforce
attribute renderAs?
15MB
What is a profile?
A profile contains user permissions and access settings that control what users
can do within their organization.
Profiles control:
Which standard and custom apps users can view
Which tabs users can view
Which record types are available to users
Which page layouts users see
Object permissions that allow users to create, read, edit, and delete records
Which fields within objects users can view and edit
Permissions that allow users to manage the system and apps within it
Which Apex classes and Visualforce pages users can access
Which desktop clients users can access
The hours during which and IP addresses from which users can log inidentity
provider)
What is Permission Set?
A permission set is a collection of settings and permissions that give users access
to various tools and functions. The permission sets extend users functional access
without changing their profiles.
For example, to give users access to a custom object, create a permission set,
25
enable the required permissions for the object, and assign the permission set to
the users. Users can have only one profile, they can have multiple permission sets.
What is OWD?
OWD(organization wide defaults) provide an access to all users in that
organization. There are 4 types of OWDs:
private no once can access it except the owner.
Public Read Only Every can read the record based on their profile permissions
for that object.
Public Read/Write - Every can read or edit the record based on their profile
permissions for that object.
Public Read/Write/Transfer - Every can read or edit or transfer the record based
on their profile permissions for that object.
What is most restricted level of access?
Profile is most important.
How do you implement record level security? Or Types of Security?
There are different ways to control the record level access:
profile, permission sets, OWD, Role Hierarchy, Sharing Rules, Manual Sharing,
Apex Sharing (writing apex method to control) the records.
What is Role?
We use Roles to provide vertical access. For example, if A is in higher position
than B then if we want to give additional permissions on B's records to A then we
use Roles. Depending on your sharing settings, roles can control the level of
visibility that users have into your organizations data.
Can we create a user without profile?
No, we can not create user without profile. Every user in salesforce must have
profile.
If you hide a tab in profile than the user can see the records?
No, they can see the records in UI. But if they have permission on that object then
they can query records from the database using SoQL or SOSL or they can use
tools like force.com explorer, etc..
The differences between public group, private group and Queue?
Groups are sets of users. They can contain individual users, other groups, the
users in a particular role or territory, or the users in a particular role or territory
plus all of the users below that role or territory in the hierarchy.
26
Public Groups: Only administrators can create and edit public groups
Private Groups: Any user can create and edit their own personal groups.
Queues: Queues help your teams manage leads, cases, service contracts, and
custom objects. Once records are placed in a queue manually or through an
automatic case or lead assignment rule, records remain there until they're
assigned to a user or taken by one of the queue members. Any queue member or
users above them in the role hierarchy can take ownership of records in a queue.
Can we create a custom profile?
Yes, we can create a custom profile by using the exiting profile.
How many ways do you share the records?
Salesforce has the following types of sharing:
Record Ownership: Owner will have full access by default on all records
to view, edit, transfer, share, and delete the record.
Role Hierarchy: We use Roles to provide vertical access. For example, if A
is in higher position than B then if we want to give additional permissions on
B's records to A then we use Roles. Depending on your sharing settings, roles
can control the level of visibility that users have into your organizations data.
Sharing Rules: Sharing rules are used by administrators to automatically
grant users within a given group or role access to records owned by a specific
group of users. Sharing rules can be based on record ownership or other
criteria.
Manual Sharing - Users can manually share records access with other users
including accounts, contacts, and leads. In some cases, sharing one record
includes access to all its associated records. This method of granting access is also
known as a manual share.
Apex Managed Sharing: Apex managed sharing provides developers with the
ability to support an applications particular sharing requirements
programmatically through Apex or the SOAP API. This type of sharing is similar
to Force.com managed sharing. Only users with Modify All Data permission can
add or change Apex managed sharing on a record.
What is the use of Transfer Record in profile?
If user have only Read access on particular record but he wants to change
the owner name of that record, then in profile level Transfer Record enables he
can able to change the owner.
What is Field dependency?
27
According to the field selection on one field filter the pick list values on
other field.
Is check box performs like controlling field?
Yes possible. Controlling field should be Check box or pick list.
What are formula and Rollup Summary fields and Difference between
them? When should Rollup- Summary field enable?
Formula: A read-only field that derives its value from a formula expression that
we define. The formula field is updated when any of the source fields change.
Rollup Summary: A read-only field that displays the sum, minimum, or
maximum value of a field in a related list or the record count of all records listed
in a related list.
Difference is below:
Formula fields calculate values using fields within single record, roll-up summary
fields calculate values from a set of related records.
When we give the master-detail relationship it gets enable to the master object
What are the Record Types?
Record Types are restrict the pick list values and assign to the different
page layouts for different Record Types.
What is Audit Trail?
Audit Trail provides the information or track all the recent setup changes that an
administrator done to the organization.
This can store the last 6 months data.
What are the Report Types?
4 Types of report in Salesforce
Tabular Reports: We can only displays the grand total in the table form.
Summary Reports: It is a detail form of report in which the grouping done
based on Columns.
Matrix Reports: It is a detail form of report in which the grouping done based
on both Rows and Columns.
28
Joined Reports: We can join the two or more reports in the single report
displayed in the form of blocks.
What is Dashboard?
Dashboard is a pictorial representation of report. We can add up to 20 reports in
single dashboard.
Pros of Private Cloud
Security: The security risks associated with the private cloud tend to be
less prominent than those of the public cloud. The location of the data is
available to the service owner unlike with the public cloud.
Costs: The initial costs of the private cloud tend to be higher than the public
cloud but decline as the time of usage increases.
Data Storage: Larger amounts of data can be stored in the private cloud
for a lower cost.
Pros of Public Cloud
Costs: The initial costs of the public cloud are lower but tend to go up over
time.
Data Storage: Many different types of data can be stored in the public
cloud however large amounts stored for long periods tend to get pricey.
Accessibility: The public cloud can be accessed from a number of location
and a number of ways unlike the private which can only be reached from
one source.
Availability: The public cloud has so far proven to be more reliable and
available thus drawing many users.
Objects?
Using Import wizard, we can upload up to 50,000 records.Only Accounts &
Contacts, Leads and Solutions and custom objects data can be imported. If we
want to import other objects like Opportunities and other objects data, then we
need to go for Apex Data Loader.
30
Advantages
Disadvantages
No working software is produced until
late during the life cycle.
Cannot
accommodate
requirements.
changing
Agile SDLC: It is also called incremental model where as and when they find
the new requirements, they implement, test and create unit test cases for
31
regression, then they find the gap, follow the same process again. Most
complicated and very reliable methodology.
33
13. What are the differences between soft delete & Hard delete in
salesforce?
Hard Delete Vs Soft Delete:
Deleted Records:
The Recycle Bin link in the sidebar lets you view and restore recently deleted
records for 15
days before they are permanently deleted. If your organization reaches its
Recycle Bin limit,
Salesforce automatically removes the oldest records if they have been in the
Recycle Bin for at
least two hours. Your organization can have up to 5,000 records per license in
the Recycle Bin
at any one time. For example, if your organization has five user licenses, 25,000
records can
be stored in the Recycle Bin.
Deleted Fields:
Deleted custom fields and their data are stored until your organization
permanently deletes
them or 15 days has elapsed, whichever happens first. Until that time, you can
restore the field
and its data. However, the field still counts against the maximum number of
custom fields
allowed in your organization.
Standard fields can not be deleted ONLY customer fields of standard
or custom object
can be deleted.
Deleted Objects:
When you delete a custom object, Salesforce does not add it to the Recycle Bin.
Instead,
deleted objects appear in the Deleted Objects list for 15 days. During this time, the
object
and its data are soft deleted, meaning you can restore or permanently erase (hard
delete)
the object and its data. After 15 days, the object and its data are automatically
hard
deleted.
34
35
Security Questions:
a record.
Object Relationships in SalesForce
37
Use relationships to associate an object with other objects in Salesforce. You can
define different types of relationships by creating custom relationship fields on an
object.
There four different relationships can be built in Force.com Platform.
Look up (Parent and Child) Two Different Objects
Self Lookup (Same Object) Self Relationship is a lookup relationship on the
same object
Master Detail - This type of relationship closely links objects together such that
the master record controls certain behaviors of the detail
Many To Many - many-to-many relationships between any two objects
SalesForce has two data types to create relationships. Look up and Master Detail
Look up Relationship
Loosely coupled
Child field may be optional
No cascade Delete
Independent ownership and sharing
Maximum 25 lookup relationships per child object
Master Detail Relationships
Child field value is always required
Cascade Delete
Inherited ownership and sharing
Maximum 2 master relationships per detail object
Many to Many Relationship
A many-to-many relationship allows each record of one object to be linked
to multiple records from another object and vice versa.
Use Junction Object to connect the two objects
A Junction Object is a custom object with two Master Detail relationships
Look up
Parent is not required field
No impact on security and
sharing
No cascade delete
Master Detail
Parent is required field
Inherits parent security
and sharing
Cascade Delete
38
25
relationships
possible
A profile contains user permissions and access settings that control what users
can do within their organization
Which standard and custom apps users can view
Which tabs users can view
Which record types are available to users
Which page layouts users see
Object permissions that allow users to create, read, edit, and delete records
(CRUD)
Which fields within objects users can view and edit
Permissions that allow users to manage the system and apps within it
Which Apex classes and Visualforce pages users can access
Which desktop clients users can access
The hours during which and IP addresses from which users can log in
Which service providers users can access (if Salesforce is enabled as an identity
provider)
In Contact Manager, Group, and Professional Edition organizations, you can
assign standard profiles to your users,
but you can't view or edit the standard profiles or create custom profiles. In
Enterprise, Unlimited, and Developer
Edition organizations, you can use standard profiles, or create, edit, and delete
custom profiles. For standard profiles,
only certain settings can be changed.
Each standard or custom profile belongs to exactly one user license type.
What is a Permission Set?
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.
For example, to give users access to a custom object, create a permission set,
enable the required permissions for the object, and assign the permission set to
the users. You never have to change profiles, or create a profile for a single use
case.
39
While users can have only one profile, they can have multiple permission sets.
Can you assign a Permission Set to Public Group?
Record Level Security (Sharing)
Record-Level Security (Sharing)
Record-level security lets you give users access to some object records, but not
others. Every record is owned by a user or a queue. The owner has full access to
the record.
Organization Wide Defaults, Role Hierarchy, Sharing Rules, Manual
sharing Rules, Apex Managed Sharing Rules are different settings in SalesForce
to share the record with other users.
Organization Wide Defaults settingsThe first step in record-level security is to
determine the
organization-wide sharing settings for each object. Organization-wide sharing
settings specify the
default level of access users have to each others records.
Private
Public Read Only
Public Read Write
You use organization-wide sharing settings to lock down your data to the most
restrictive level, and then use the other record-level security and sharing tools to
selectively give access to other users. For example, lets say users have object-level
permissions to read and edit opportunities, and the organization-wide sharing
setting is Read-Only. By default, those users can read all opportunity records, but
cant edit any unless they own the record or are granted additional permissions.
Role hierarchyOnce youve specified organization-wide sharing settings, the
first way you can give wider access to records is with a role hierarchy. Similar to
an organization chart, a role hierarchy represents a level of data access that a user
or group of users needs. The role hierarchy ensures that users higher in the
hierarchy always have access to the same data as people lower in their hierarchy,
regardless of the organization-wide default settings. Role hierarchies dont have
to match your
organization chart exactly. Instead, each role in the hierarchy should represent a
level of data access that a user or group of users needs.
You can also use a territory hierarchy to share access to records. A territory
hierarchy grants users access to records based on criteria such as zip code,
industry, revenue, or a custom field that is relevant to your business. For example,
you could create a territory hierarchy in which a user with the North America
role has access to different data than users with the Canada and United States
roles.
Note
Although its easy to confuse permission sets and profiles with roles, they control
40
two very different things. Permission sets and profiles control a users object and
field access permissions. Roles primarily control a users record-level access
through role hierarchy and sharing rules.
Sharing rulesSharing rules let you make automatic exceptions to organizationwide sharing
settings for particular sets of users, to give them access to records they dont own
or cant normally see. Sharing rules, like role hierarchies, are only used to give
additional users access to recordsthey cant be stricter than your organizationwide default settings.
Manual sharingSometimes its impossible to define a consistent group of users
who need access to a particular set of records. In those situations, record owners
can use manual sharing to give read and edit permissions to users who would not
have access to the record any other way. Although manual sharing isnt automated
like organization-wide sharing settings, role hierarchies, or sharing rules, it gives
record owners the flexibility to share particular records with users that need to
see them.
Apex managed sharingIf sharing rules and manual sharing dont give you the
control you need, you can use Apex managed sharing. Apex managed sharing
allows developers to programmatically share custom objects. When you use Apex
managed sharing to share a custom object, only users with the Modify All Data
permission can add or change the sharing on the custom object's record, and the
sharing access is maintained across record owner changes.
Triggers and Order of Execution
When you save a record with an insert, update, or upsert statement, Salesforce
performs the following events in order.
Note
Before Salesforce executes these events on the server, the browser runs JavaScript
validation if the record contains any dependent picklist fields. The validation
limits each dependent picklist field to its available values. No other validation
occurs on the client side.
On the server, Salesforce:
1. Loads the original record from the database or initializes the record for an
upsert statement.
2. Loads the new record field values from the request and overwrites the old values.
If the request came from a standard UI edit page, Salesforce runs system
validation to check the record for:
Compliance with layout-specific rules
Required values at the layout level and field-definition level
Valid field formats
Maximum field length
Salesforce doesn't perform system validation in this step when the request comes
41
}
}
43
Scenarios:
1)
controller="CustomerController"
45
<apex:pageBlock title="{!CompanyName}">
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!allaccounts}" var="a">
<apex:column headerValue="Account Name">
<apex:outputText value="{!a.name}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:pageBlockSection columns="2">
<apex:pageBlockTable value="{!allContacts}" var="a">
<apex:column headerValue="Contact Name">
<apex:outputText value="{!a.name}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:pageBlockSection columns="3">
<apex:pageBlockTable value="{!allEmployees}" var="a">
<apex:column headerValue="Employee Name">
<apex:outputText value="{!a.name}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
Custom Controller:
public class CustomerController {
public list<account> getallaccounts()
{
return ( [select name from account]);
}
public list<contact> getallContacts()
{
return ( [select name from contact]);
}
public list<Employee__c> getallEmployees()
{
return ( [select name from Employee__c]);
}
}
46
3) Write a test class to test more than one piece of apex code (apex
code could be a trigger or could be a class)?
Can we write more than one test method in one test class? Can we
write trigger test method, schedulable Class Test methods in one Test
Class?
Trigger 1:
trigger TestRejectDuplicateTrigger on Account (before insert,before update) {
list<account> la=[select name from account];
account a=trigger.new[0];
for(account ac:la)
if(ac.name == a.Name)
a.addError('Found duplicate, Can not Insert, can not update');
}
Trigger 2:
trigger TestCodeCoverage on Book__c (before insert,before update)
{
if((trigger.isbefore) && (trigger.isinsert))
system.debug('This trigger is fired due to insert');
if((trigger.isbefore) && (trigger.isupdate))
system.debug('This trigger is fired due to update');
list<Book__c> lb=[select name from Book__c];
book__C iORu=trigger.new[0];
for(book__c b: lb)
if (b.name == iORu.name)
iORu.addError('Found duplicate, Can not Insert & update');
}
Schedulable Class 1:
global class ScheduleEmailTest implements schedulable
{
global void execute(schedulablecontext sc)
{
Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();
mail.setToAddresses(new string[]{'[email protected]'});
mail.setReplyTo('[email protected]');
mail.setSenderDisplayName('Raveendra');
47
List<offer__C>
lo
list<job_application__C>
listjobs=[select
id,
job_application__C];
for
(offer__c
for(job_application__C
if(o.Job_Application__c
==
=trigger.new;
name
from
o:lo)
j:listjobs)
j.id)
{
J.status__c='Approved';
J.stage__C='Completed';
lj.add(j);
}
update
lj;
50
3. Triggers
4. Email services
standardController="Account"
>
>
>
value="{!account.contacts}"
var="c">
value="{!c.name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
51
1) Write a apex code to test if a given account exists using LIST and
SET?
public class TestCollectionDataTypes {
public void display()
{
list<account> la=[select name, numberofemployees, annualrevenue from
account];
set<account> sa= new set<account>();
for(account a:la)
sa.add(a);
account aa=[select name, numberofemployees, annualrevenue from account
where name like 'Edge%' ];
system.debug('Is Edge Communication exists in sa? ' + sa.contains(aa));
system.debug('All accounts in sa? ' + sa);
}
}
52
Cisco
Call
Center
App:
Cisco systems use salesforce as their ticketing system where they can store
information on all cases/resolutions. I was involved in creating triggers based on
the ticket severity (severity 1 cases should be resovled in 24 hours, sev 2 should
be
resolved
in
2
days,
sev
3
and
4
in
one
week)
I have created a trigger to notify support manager as soon as we receive a ticket
of sev 1 so that support manager will assign that ticket to SME of their team for
faster
resolution.
I was involved in creating workflow rules for even distribution of work load with
all engineers in queue. so that all engineers will enough workload.
Created a workflow to notify manager if there is no progress on any ticket after 14
days of the ticket creation so that this ticket will be assigned to some expirenced
engineer
for
faster
resolution.
Created a trigger to notify an support manager as soon as SYSTEM DOWN
condition ticket hits the pmr . SYSTEM DOWNs are very critical for production
servers
and
they
have
to
be
resolved
in
2
hours.
Created different kinds for reports for support manger to discuss on weekly calls:
Weekly
Reports:
1) Case number, Age of the Case, Severity of the Case, Assigned Engineer.
2) New case number, description, customer details, Time zone, Is Engineer
Assigned(Yes/No)
3) Closed Case Number, Description, age, closure procedure (did we resolve the
issue/customer
resolved
own
issue/did
we
provide
fix)?
NCI
Sales
App:
NCI use salesforce for their marketing, sales. For marketing, the store
information about their leads and opportunities and customers.
Leads - who have shown interest to know more about our products by visiting our
53
webinars,
campigns,
workshops,
direct
mails,
etc.
Opportuinites - Who have shown interest in our products but expecting some kind
of
offers/approvals,
I was involved in creating workflow rules to notify concerned marketing
sales/marketing team with all details on new lead or opportunity so that
sales/marketing
will
follow
up
with
leads/opportunities.
I was involved in writting triggers to make sure we have all the information
required to contact lead/opportunity for further follow up at the time record
creation.
I was involved in creating trigger to have all details including next communication
date, whom did we contact, complete description of our conversation, etc.. during
the
record
update.
I was invloved in creating REST webservices to receive complete information by
giving their phone number or email id. To create Webservices, the customer site
should be registered with salesforce and once registed then we can the
information
required
by
giving
the
id
of
the
record.
I was invloved in creating REST webservices to receive complete information on
shipping address, quantity of material to be shipped by giving the order number.O
I was also involved in creating various reports on orders, current stock, ordered
stock, etc..
Please
let
me
know
if
you
have
any
questions?
Week-1
54
<script>
function DisplayDate()
{
document.write(Date());
}
</script>
<apex:form>
<apex:commandButton value="Display Date!!" onclick="DisplayDate()">
</apex:commandButton>
</apex:form>
</apex:page>
Govenor Limits:
What are Apex Governor Limits?
Governor limits are runtime limits enforced by the Apex runtime engine.
Because Apex runs in a shared, multitenant environment, the Apex runtime
engine strictly enforces a number of limits to ensure that code does not
monopolize shared resources. Types of limits that Apex enforces are
resources like memory, database resources, number of script statements to
avoid infinite loops, and number of records being processed. If code exceeds
a limit, the associated governor issues a runtime exception.
Description
Total number of SOQL queries issued
Total number of SOQL queries issued for Batch Apex and future
methods
Total number of records retrieved by SOQL queries
Total number of SOSL queries issued
Total number of records retrieved by a single SOSL query
Total number of DML statements issued2
Total number of records processed as a result of DML
statements, Approval.process, or database.emptyRecycleBin
Total number of executed code statements
55
Limit
100
200
50,000
20
2000
150
10,000
200,000
1,000,000
200
10
6MB
12MB
16
120
seconds
10 seconds
10
3MB
10
100
25
}
Test Cases:
1)
2)
3)
Bulkify Triggers:
we write bulkify triggers to make sure the code properly handles more than one
record at a time. There are cases where a single instance of that Apex code is
executed, but it needs to handle all of the records in that given batch. So, the
records need to be processed as a bulk to avoid hitting governor limits.
Instead of assigning trigger.new[0] to an object write a for loop for all records in
that batch:
Example:
Account a= trigger.new[0];
List<Contact> contacts = [select id, salutation, firstname, lastname,
email from Contact where accountId = :acct.Id];
The above code works perfectly fine when the trigger fired to process just one
record and the same code fails if the trigger fired to process more than one records.
In such cases, we need to write:
for (account a:tigger.new)
Which processes records upto 200 without hitting governor limits.
Example: (Bulkify Trigger):
trigger RejDups on Account (before insert) {
list<account> allaccounts=[select name from account];
for(account newaccount:trigger.new)
for (account oneaccount:allaccounts)
if(newaccount.name==oneaccount.name)
57
58
isInsert
isUpdate
isDelete
isBefore
isAfter
isUndelete
Usage
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.
Returns true if this trigger was fired due to an insert
operation, from the Salesforce user interface, Apex, or
the API.
Returns true if this trigger was fired due to an update
operation, from the Salesforce user interface, Apex, or
the API.
Returns true if this trigger was fired due to a delete
operation, from the Salesforce user interface, Apex, or
the API.
Returns true if this trigger was fired before any record
was saved.
Returns true if this trigger was fired after all records were
saved.
Returns true if this trigger was fired after a record is
59
Variable
Usage
recovered from the Recycle Bin (that is, after an undelete
operation from the Salesforce user interface, Apex, or the
API.)
Returns a list of the new versions of the sObject
records.
new
newMap
old
oldMap
size
60
{
list<integer> li=new list<integer>();
li.add(25);
li.add(35);
map<integer, list<integer>> mli=new map<integer, list<integer>>();
mli.put(25,li);
mli.put(35,li);
list<map<integer,
list<integer>>>();
lma.add(mli);
list<integer>>>
lma=new
list<map<integer,
}
}
Do you know about access modifiers? What is access modifiers? How
many types of modifiers?
There are four types of access modifiers in salesforce:
Private It is by default, Accessible within the class.
Protected Accessible with in the class and it's sub class.
Public Accessible with in the application or with in the namespace.
Global Accessible outside of the application as well, if the method is global then
the class name must be global.
What is constructor? Do you know anything about constructors?
Constructor do have the same name as class and it does not return any value.
For Example:
Class Doctor
{
Doctor()
{
}
}
What are the static variables & methods? Where do you use them?
Static methods which are associated with the class, not with the instance (object).
We can call static methods & variables using class name.
For Example:
63
Class Doctor
{
static void method1()
{
}
}
We can call method1 using class name. For example: Doctor.method1();
How do you define constants(final) in salesforce?
We use final keyword to declare constants. For Example, Hospital address will
not be changed very often. So, we can declare Hospital address as final.
Final Address = '1 Mall Road, Burlington,MA 01803';
What is sObject?
sObject is a abstract object type. We can assign any standard object or custom
object to sObject such as an account or the Invoice_Statement__c custom object.
Do you know about SoSL or SoQL? When do we use them?
Salesforce Object Query Language (SOQL) is a query language for data operations
of a single sOobject and its related sObjects. We Can't use SoQL for Joins.
Salesforce Object Search Language (SOSL) is a search language for searching
across all multiple objects simultaneously.
What is DML statements? And the database operations? What are the
differences between them?
We use data manipulation language (DML) operations to insert, update,
delete, and restore data in a database.
The following Apex DML operations are available:
whether the operation allows for partial success. If set to false and a record
fails, the remainder of the DML operation can still succeed. The Database
DML methods return the results to Database.SaveResult[].
The difference:
When we are inserting more number of records and if there is any problematic
record then DML statement stops insert at that record whereas database class
insert method proceed with next record and save the results.
Have you ever used eclipse? Do you use any tools?
Yes.. we use eclipse to write our code.
What are differences between Enterprise WSDL and Partner WSDL?
Enterprise
WSDL
A strongly typed WSDL for customers who want to build an integration with their
salesforce.com organization only.
Partner
WSDL
A loosely typed WSDL for customers, partners, and ISVs who are building client
applications for multiple organizations. It can be used to access data within any
organization.
We can generate Apex classes from WSDL Files by selecting Generate From
WSDL from Apex Classes.
65
Q12) Is there any way to prevent record view for a person high in role
hierarchy?
Yes.. We can do so if the user in role hierarchy does not have permission on that
object in his profile.
67
Have you ever used Webservices like REST API or SOAP API?
Yes.. we tested REST using workbench tool provided by salesforce for Testing and
SOAP API tested with Strike Iron. StrikeIron is the cloud company to provide
reliable Data-as-a-Service (DaaS) platform in the market. They give 30 day free
access for testing Email Verification, Phone Number verification. For example:
When we give phone number then we get the complete address of the phone
number.
1. What is Apex
It is the in-house technology of salesforce.com which is similar to Java
programming with object
oriented concepts and to write our own custom logic.
2. Is it possible to write the Apex code from user Interface?
You can add, edit, or delete Apex using the Salesforce.com user interface only in
a Developer
Edition organization, a Salesforce.com Enterprise Edition trial organization, or
sandbox
organization. In a Salesforce.com production organization, you can only make
changes to Apex
by using the Metadata API ,deploy call, the Force.com IDE, or theForce.com
Migration Tool.
The Force.com IDE and Force.com Migration Tool are free resources provided by
salesforce.com
to support its users and partners, but are not considered part of our Services for
purposes of the
salesforce.com Master Subscription Agreement.
3. In How many ways we can invoke the Apex class?
a. Triggers
b. Web Services
68
c. Email Services
d. Batch Classes
e. Schedulable Classes
f. Test Classes
g. Controller Classes for Visualforce pages
4. What is a class and explain in detail?
Apex classes are similar to Java classes.
A class is a template or blueprint from which Apex objects are created. Classes
consist of other
classes, user-defined methods, variables, exception types, and static initialization
code. They are
stored in the application under Setup, in Develop | Apex Classes.
An Apex class can contain variables and methods.
Variables are used to specify the state of an object, such as the object's name or
type. Since
these variables are associated with a class and are members of it, they are referred
to as
member variables.
Methods are used to control behavior, such as purchasing or selling an item.
Methods can also contain local variables that are declared inside the method and
used only by
the method. Whereas class member variables define the attributes of an object,
such as name
or height, local variables in methods are used only by the method and dont
describe the class.
5. What is the Syntax for a Class?
6. What are Access Modifiers in SalesForce?
Apex allows using the private, protected, public, and global access modifiers when
defining
methods and variables.
public
This means the method or variable can be used by any Apex in this application or
namespace.
global
This means the method or variable can be used by any Apex code that has access
to the class,
not just the Apex code in the same application. This access modifier should be
used for any
method that needs to be referenced outside of the application, either in the SOAP
API or by
other Apexcode. If we declare a method or variable as global, we must also declare
69
scope of the request. They are not static across the server, or across the entire
organization.
When you need to have a member variable whose value is available to all instances
need to
create a static variable. Static variables are associated with the class and not the
instance and
you can access them without instantiating the class.
11.What is the scope of static variable?
When you declare a method or variable as static, its initialized only once when a
class is loaded.
Static variables arent transmitted as part of the view state for a Visualforce page.
Static variables are only static within the scope of the request. They are not static
across the
server, or across the entire organization.
12.What are the Keywords in SalesForce?
Apex has the following keywords available:
final
instanceof
super
this
transient
with sharing and without sharing
13.Explain with sharing and without sharing key words?
Apex generally runs in system context; that is, the current user's permissions,
field-level security,
and sharing rules arent taken into account during code execution.
Because these rules aren't enforced, developers who use Apex must take care that
they don't
inadvertently expose sensitive data that would normally be hidden from users by
user
permissions, field-level security, or organization-wide defaults. They should be
particularly
careful with Web services, which can be restricted by permissions, but execute in
system
context once they are initiated.
Use the with sharing keywords when declaring a class to enforce the sharing rules
that apply to
the current user.
14.What is an Interface?
An interface is a named set of method signatures (the return and parameter
definitions), but
without any implementation.
71
Interfaces provide a layer of abstraction to your code. They separate the specific
implementation
of a method from the declaration for that method. This way, you can have different
implementations of a method based on your specific application.
15.What is a Sub class?
Apex supports subclasses, allowing you to create a class that extends another class.
The subclass
inherits all the functionality of that parent class. It can also have additional
methods and
member variables, and can override the behavior of existing parent class methods.
16.What are Primitive Data Types in APEX Language?
Apex has a number of primitive data types. These are used to store data at run
time.
String: Strings are set of characters and are enclosed in single quotes. They store
text values such
as a name or an address.
Integer, Long, Double and Decimal: Variables declared with any of these
data types hold
numeric values.
Time, Date and Datetime: Variables declared with any of these data types hold
time, date, or
time and date values combined
Boolean: Boolean values hold true or false values and you can use them to test
whether a
certain condition is true or false
17.What is ID data type?
The ID data type represents an 18-character an object identifier. Force.com sets
an ID to a object
once it is inserted into the database. For example, an ID value can be
a02D0000006YLCyIAO.
18.What are Collection Objects?
Apex has the following types of collections:
Lists
Maps
Sets
A list is a collection of elements, such as Integers, Strings, objects, or other
collections.
List holds an ordered collection of objects.
Use a list when the sequence of elements is important. List can have duplicate
elements .
The index position of the first element in a list is always 0.
72
The advantage of using exceptions is that they simplify error handling. Exceptions
bubble up
from the called method to the caller, as many levels as necessary, until a catch
statement is
found that will handle the error.
using finally statements, we have one place to recover from exceptions, like
resetting variables
and deleting data.
When an exception occurs, code execution halts and any DML operations that
were processed
prior to the exception are rolled back and arent committed to the database.
Exceptions get
logged in debug logs. For unhandled exceptions, that is, exceptions that the code
doesnt catch,
Salesforce sends an email to the developer with the organization ID and user ID
of the running
user, as well as the exception message.
If you run into an exception that occurred in Apex code while using the standard
user interface,
an error message appears on the page showing you the text of the unhandled
exception
25. Explain Try, Catch and Finally Statements in SalesForce?
Apex uses try, catch and finally statements to handle exceptions.
The try statement identifies a block of code in which an exception can occur. If
you have code
that you think could generate an exception, wrap this section of your code in a try
block, and add
a catch block after it. Only exceptions thrown from the code wrapped in the try
block are
handled by the catch block.
The catch statement identifies a block of code that handles a particular type of
exception. In the
previous example, notice that there are two catch statements. You can have as
many catch
statements as you like, one for each exception type you want to catch.
The finally statement is optional and gets executed after the catch block executes.
Code in the
finally block always executes regardless of the type of exception that was thrown
and handled.
You can add any final clean up code here.
26. Explain some Built In Exceptions?
DML Exception
74
List Exception
NullPointerException
QueryException
SObjectException
27. How to create Custom Exception?
To create custom exception class, extend the built-in Exception class and make
sure class name
ends with the word Exception. Append extends Exception after class declaration
public class MyException extends Exception {}
28.What are different annotations in SalesForce?
An Apex annotation modifies the way a method or class is used, similar to
annotations in Java.
Annotations are defined with an initial @ symbol, followed by the appropriate
keyword. To add
an annotation to a method, specify it immediately before the method or class
definition. For
example:
global class MyClass {
@future
Public static void myMethod(String a)
{
//long-running Apex code
}
}
Apex supports the following annotations:
@Deprecated
@Future
@IsTest
@ReadOnly
@RemoteAction
@TestVisible
Apex REST annotations:
@RestResource(urlMapping='/yourUrl')
@HttpDelete
@HttpGet
@HttpPatch
@HttpPost
@HttpPut
29.What is a Test Class in SalesForce?
To facilitate the development of robust, error-free code, Apex supports the
75
creation and
execution of unit tests. Unit tests are class methods that verify whether a
particular piece of
code is working properly.
Unit test methods take no arguments, commit no data to the database, send no
emails, and are
flagged with the testMethod keyword or the isTest annotation in the method
definition.
Classes defined with the isTest annotation don't count against your organization
limit of 3
MB for all Apex code.
At least 75% of your Apex code must be covered by unit tests
Also, test methods must be defined in test classes, that is, classes annotated with
isTest.
@isTest
private class myClass {
static testMethod void myTest() {
code_block
}
}
@isTest
private class myClass {
@isTest static testMethod void myTest() {
code_block
}
}
Test methods cant be used to test Web service callouts. Instead, use mock callouts.
See Testing
Web Service Callouts and Testing HTTP Callouts.
We cant send email messages from a test method.
Since test methods dont commit data created in the test, we dont have to delete
test data
upon completion.
30.Explain System.runAs()
Generally, all Apex code runs in system mode, and the permissions and record
sharing of the
current user are not taken into account. The system method, System.runAs(),
lets you write test
methods that change user contexts to either an existing user or a new user. All of
that users
record sharing is then enforced. You can only use runAs in a test method.
The original system
76
Note that this sObject list is only available in update and delete triggers.
37.How to restrict any Trigger to fire only once? Or What is Recursive
Triggers?
You want to write a trigger that creates a new record as part of its processing logic;
however, that
record may then cause another trigger to fire, which in turn causes another to fire,
and so on. You
don't know how to stop that recursion.
The before and after triggers fire one more time only if something needs to be
updated. If the
fields have already been set to a value, the triggers are not fired again.
Workaround:
Create a Helper Class, with a static Boolean variable.
Check its value within the affected triggers.
After the trigger is executed , set the Boolean to True.
Class HelperForTriggerA{
public static TriggerExecuted = False;
}
Trigger on Account(After Insert){
if (HelperForTriggerA.TriggerExecuted ==False){
Code Block
HelperForTriggerA.TriggerExecuted ==True;
}
}
38. In class declaration if we dont write keyword with sharing then
it runs in system mode then
why keyword without sharing is introduced in apex?
Lets take example, there is classA declared using with sharing and it calls
classB method.
classB is not declared with any keyword then by default with sharing will be
applied to that
class because originating call is done through classA. To avoid this we have to
explicitly define
classB with keyword without sharing.
39.What is Scheduler class in Apex?
The Apex class which is programmed to run at pre defined interval.
Class must implement schedulable interface and it contains method named
execute().
There are two ways to invoke scheduler :
1. Using UI
2. Using System.schedule
The class which implements interface schedulable get the button texted with
79
Schedule, when
user clicks on that button, new interface opens to schedule the classes which
implements that
interface.
To see what happened to scheduled job, go to Monitoring | Scheduled jobs
40.What is difference in ISNULL and ISBLANK?
ISNULL:
Determines if an expression is null (blank) and returns TRUE if it is. If it contains
a
value, this function returns FALSE.
Text fields are never null, so using this function with a text field always returns
false. For
example, the formula field IF(ISNULL(new__c) 1, 0) is always zero regardless of
the value in
the New field. For text fields, use the ISBLANK function instead.
Multi-select picklist fields are never null in s-controls, buttons, and email
templates, so
using this function with a multi-select picklist field in those contexts always
returns false.
Empty date and date/time fields always return true when referenced in ISNULL
functions.
Choose Treat blank fields as blanks for your formula when referencing a number,
percent, or currency field in an ISNULL function. Choosing Treat blank fields as
zeroes gives
blank fields the value of zero so none of them will be null.
Merge fields can be handled as blanks, which can affect the results of
components like scontrols
because they can call this function.
When using a validation rule to ensure that a number field contains a specific
value, use
the ISNULL function to include fields that do not contain any value. For example,
to validate
that a custom field contains a value of 1, use the following validation rule to
display an
error if the field is blank or any other number: OR(ISNULL(field__c),
field__c<>1)
ISBLANK:
Determines if an expression has a value and returns TRUE if it does not. If it
contains a
value, this function returns FALSE.
Use ISBLANK instead of ISNULL in new formulas. ISBLANK has the same
functionality as
80
ISNULL, but also supports text fields. Salesforce.com will continue to support
ISNULL, so you
do not need to change any existing formulas.
A field is not empty if it contains a character, blank space, or zero. For example,
a field
that contains a space inserted with the spacebar is not empty.
Use the BLANKVALUE function to return a specified string if the field does not
have a
value; use the ISBLANK function if you only want to check if the field has a value.
If you use this function with a numeric field, the function only returns TRUE if
the field
has no value and is not configured to treat blank fields as zeroes.
41. What is the dynamic Apex?
Dynamic Apex enables developers to create more flexible applications by
providing them with
the ability to Access sObject and field describe information, Write
Dynamic SOQL Queries,
Write Dynamic SOSL Queries and Dynamic DML.
42.What is a Visualforce Page ?
Visualforce is the new markup language from salesforce, by using which, We can
render the
standard styles of salesforce. We can still use HTML here in Visualforce. Each
visualforce tag
always begins with apex namespace. All the design part can be accomplished by
using
Visualforce Markup Language and the business logic can be written in custom
controllers
associated with the Page
43.Where to write Visualforce code ?
You can write the code basically in 3 ways.
1. setup->App Setup->Develop->Pages and create new Visulaforce page.
2. Setup -> My Personal Information -> Personal Information -> Edit checks the
checkbox
development mode. When you run the page like this,
https://ap1.salesforce.com/apex/MyTestPage. you will find the Page editor at the
bottom of
the page. You can write you page as well as the controller class associated with it,
there it
self.
3. Using EclipseIDE you can create the Visulaforce page and write the code.
44. Explain the MVC design pattern of Salesforce.com
Model view controller (MVC) design pattern is the one of the most popular design
81
pattern in 3 tier
applications. Salesforce.com is award winning tool to manage all the data of sales
team of an
organization. The flexibility and assurance of safe data provided by
Salesforce.com results into
nonparallel development capabilities to the developer. One normal questions
asked in salesforce is
explaining the MVC behavior of the application.
So lets discuss that how Salesforce.com uses MVC pattern.
MVC pattern contains below three modules:
1. Model
2. View
3. Controller
Model : What schema and data does salesforce uses to represent the system
completely. In
salesforce, we can say that sObjects are the model as every entity in salesforce is
mapped to some
sObject.
View : How the schema and data is represented. Visualforce is used to present
the data to users.
Controller : How the interface actions. Controllers are used to perform the
actions whenever users
interact with visual force
45.How to display error messages in the visualforce page ?
In Apex use below code to create the error message for visualforce.
1
Apexpages.addMessage(
new
ApexPages.Message
(ApexPages.Severity.ERROR,'Required fields are
missing. '));
in Visualforce page add below tag where you want to display the error message.
<apex:pageMessages ></apex:pageMessages>
46.What is the controller extension?
Any apex class having a public constructor with Custom Controller or Standard
Controller object
as a single argument is known as controller extension.
47.How many controllers can be used in a visual force page?
we can use only ONE controller at a time in VF page, it could be either standard
or custom controller. But we can has as many as extensions that we need.
47a) What if we have the same method in all extensions?
82
For eample: Ext1 has display(), Ext2 has display(), Ext3 has display() as well then
which method would be called when we click on button.
They go order.
<apex:page controller="CustomerController" extensions="Ext1, Ext2, Ext3">
then display() in Ext1 will be called.
<apex:page controller="CustomerController" extensions="Ext2, Ext3, Ext1">
then display() in Ext2 will be called.
render It works like display property of CSS. Used to show or hide element.
rerender After Ajax which component should be refreshed available on
commandlink,
commandbutton, actionsupport etc.
renderas render page as pdf, doc and excel.
52.What are the types of controller in visual force?
There are basically two types of Controller in Visual force page.
1. Standard Controller and
2. Custom Controller
53.How many Controllers can be used on single VF page?
Only one controller can be used salesforce. Other than them, Controller
extension can be
used. There may be more than one Controller extension.
Example :
<apex:page standardController="Account" extensions="ExtOne,ExtTwo"
showHeader="false">
<apex:outputText value="{!foo}" />
</apex:page>
if ExtOne and ExtTwo, both have the method getFoo() then the method of
ExtOne will be
executed.
A controller extension is any Apex class that contains a constructor that takes a
single
argument
of
typeApexPages.StandardController
or
CustomControllerName, where
CustomControllerName is the name of a custom controller that you want to
extend.
54.What is the need of Custom Controller in Visualforce as
everything can be done by the
combination of Standard Controller + Extension class.
a. Sharing setting is applied on standard object/extension by default; In case we
dont want
to apply sharing setting in our code then Custom controller is only option.
b. It is possible that the functionality of page does not required any Standard
object or may
require more than one standard object, then in that case Custom controller is
required.
55.How to implement the pagination in SOQL ?
In spring 12, Salesforce has come up with ability of SOQL to get records from
position X instead
of position 1 every time to help creating pagination feature
56. Difference between Sandbox and Development environment?
84
your
configuration or data onto the Developer Edition, but you can customize it to
match your
instances look and feel. Once it is customized, you can use it for training, testing
or anything else
you want. It takes a little bit of work, but you can make it act and feel just like your
live instance.
The work is well worth it for the free price.
57.How to get the list of all available sobject in salesforce database
using Apex (Dynamic Apex)?
Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe();
58. How to create instance of sobject dynamically?
Normally the sobject is created like Account a = new Account();. But if you are
in situation that
you dont know which sobject is going to be instantiated ? Means it will be decided
at runtime,
how you will handle it?
Hint : Use Dynamic Apex.
public SObject getNewSobject(String t){
// Call global describe to get the map of string to token.
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
// Get the token for the sobject based on the type.
Schema.SObjectType st = gd.get(t);
// Instantiate the sobject from the token.
Sobject s = st.newSobject();
return s;
}
59. How to get all the fields of sObject using dynamic Apex?
1 Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe() ;
2 Schema.SObjectType s = m.get('API_Name_Of_SObject') ;
3 Schema.DescribeSObjectResult r = s.getDescribe() ;
4 Map<String,Schema.SObjectField> fields = r.fields.getMap() ;
60.How to get all the required fields of sObject dynamically?
There is no direct property available in Apex dynamic API to represent the
required field.
However there is another way to know about it.
If any fields have below three properties then it is mandatory field.
1. If it is Creatable
2. If it is not nillable and
3. If it does not have any default value
61.How to get the picklist value in Apex class?
Using Dynamic apex, we can achieve this.on object of type pickilist, call
86
in the picklist, which is 15,000 characters. Note that each entry includes a
linebreak and a return character that are
not visible. These two additional characters per entry are counted as part of the
15,000 character limit.
Apex Governor Limits
Because Apex runs in a multitenant environment, the Apex runtime engine
strictly enforces a number of limits to
ensure that runaway Apex does not monopolize shared resources.
Description Limit
Total number of SOQL queries issued 100
Total number of SOQL queries issued for Batch Apex and future methods 200
Total number of records retrieved by SOQL queries 50,000
Total number of SOSL queries issued 20
Total number of records retrieved by a single SOSL query 200
Total number of DML statements issued2 150
Total number of records processed as a result of DML statements,
Approval.process, or
database.emptyRecycleBin
10,000
Total number of executed code statements 200,000
Total number of executed code statements for Batch Apex and future methods
1,000,000
Total heap size 6MB
Total heap size for Batch Apex and future methods 12MB
Total stack depth for any Apex invocation that recursively fires triggers due to
insert 16
update, or delete statements 30
For loop list batch size 200
Total number of callouts (HTTP requests or Web services calls) in a request 10
Maximum timeout for all callouts (HTTP requests or Web services calls) in a
request 120 seconds
Default timeout of callouts (HTTP requests or Web services calls) in a request 10
seconds
Total number of methods with the future annotation allowed per Apex invocation
10
Maximum size of callout request or response (HTTP request or Web services call)
3MB
Total number of sendEmail methods allowed 10
Total number of describes allowed7 100
Total number of classes that can be scheduled concurrently 25
90
readability, follow Java capitalization standards and use two spaces instead of
tabs for indentation.
Use Asychronous Apex (@future annotation) for logic that does not need to be
executed
synchronous.
Asychronous Apex should be bulkified.
Apex code must provide proper exception handling.
Prevent SOQL and SOSL injection attacks by using static queries, binding
variables or the
escapeSingleQuotes method.
When querying large data sets, use a SOQL for loop
Use SOSL over SOQL where possible its much faster.
Use Apex Limits Methods to avoid hitting governor exceptions.
No SOQL or SOSL queries inside loops
No DML statements inside loops
No Async (@future) methods inside loops
Do not use hardcoded IDs
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 Leachs 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)
Visualforce
Do not hardcode picklists in Visualforce pages; include them in the controller
instead.
Javascript and CSS should be included as Static Resources allowing the browser
to cache them.
Reference CSS at the top and JavaScript at the bottom of Visualforce pages as this
provides for
faster page loads.
Mark controller variables as transient if they are not needed between server
92
Name
Created by
Created DateTime
LastModified By
Last Modified DateTime
What are the Audit Fields in SalesForce?
Meaning of Audit Fields is To track all changes for a Record:
Created By
Created DateTime
LastModified By
Last Modified DateTime
What are the System Fields in SalesForce?
ID
Created By
Created DateTime
LastModified By
Last Modified DateTime
Week-1
1. The difference between Lead and the opportunity?
Leads are people who attend our campaigns to provide some
feedback/suggestions where the
opportunities are the ones who have been selected after the filter.. once we finalize
that who
will
be interested and who will be not then we will offer some discounts of our products
or provide
some more additional information about the products only for the filtered
Leads(opportunities).
Leads are window shoppers where as opportunities are interested people.
2. Through Sales force Import wizard how many records we can
import into
salesforce Objects and the wizard will support for which Objects?
Using Import wizard, we can upload up to 50,000 records.Only Accounts &
Contacts, Leads
and Solutions and custom objects data can be imported. If we want to import
other objects
like Opportunities and other objects data, then we need to go for Apex Data
Loader.
3. What is App in Sales force?
An app is a group of tabs that work as a unit to provide functionality. Users can
94
switch
between apps using the Force.com app drop-down menu at the top-right corner
of every page.
You can customize existing apps to match the way you work, or build new apps by
grouping
standard and custom tabs.
Navigation to create app in Sales force: Setup ->Build ->Create->App->
Click on
new and create your application according to your requirements.
4.What is object in Sales force?
Custom objects are database tables that allow you to store data specific to your
organization in
salesforce.com. You can use custom objects to extend salesforce.com functionality
or to build
new application functionality.
Once you have created a custom object, you can create a custom tab, custom
related lists,
reports, and dashboards for users to interact with the custom object data. You can
also access
custom object data through the Force.com API.
Navigation to create object in sales force: Setup->Build->Create->Object->
Click on
new object and create object according to your requirement.
5. Can you name some of the standard objects and define their
purposes?
Accounts: are your organizations customers, competitors, and partners. Each
account stores
information such as name, address, and phone numbers.
Contacts: are the people that your company will have or already has an on-going
relationship. A contact, which is an individual associated with an Account.
Cases: A customer issue such as a customers feedback, problem, or question.
Solutions: A detailed description of a customer issue and the resolution of that
issue.
6. Differences between custom objects and standard objects?
Objects already created for you by Salesforce are called standard objects. Objects
you create in
your organization are called custom objects.
7. What is the difference between public cloud and private cloud? Is
salesforce.com is a public cloud or private cloud?
Public Cloud: Could services are provided as a service over the Internet with
little or no
control over the underlying technology infrastructure. More than one tenant can
95
(true) or not
(false). Because this field does not appear in all objects, it is listed in the field table
for each
object.
Audit Fields
CreatedById- ID of the User who created this record. CreatedById fields have
Defaulted on
create and Filter access.
CreatedDate- Date and time when this record was created. CreatedDate fields
have
Defaulted on create and Filter access.
LastModifiedById- ID of the User who last updated this record.
LastModifiedById fields
have Defaulted on create and Filter access.
LastModifiedDate- Date and time when this record was last modified by a user.
LastModifiedDate fields have Defaulted on create and Filter access.
SystemModstamp - Date and time when this record was last modified by a user
or by an
automated process (such as a trigger). SystemModstamp fields have Defaulted on
create
and Filter access.
12. What are the differences between System Mod Stamp and Last
Modified
Date?
System Mod Stamp and Last Modified Date are approximately same everytime.
You will find
same value for both the fields, however, there are few examples when they might
differ.
Example :
If any organization's business requirement is to move all the data/records which
already exist
in one org, to another, they will require to keep the created and last modified date
same as
when the record was actually created or modified in the original org and not when
the data
was moved in the new org.
In this case, Salesforce provides an option to modify the Last Modified date and
keep it in
sync with your original records creation or modified date.
System Mod Stamp in this case will change to the new date when the data/record
was
uploaded in new org, however, Last Modified date can manually be changed to the
98
original
date when the records were modified in old org.
13. What are the differences between soft delete & Hard delete in
salesforce?
Hard Delete Vs Soft Delete:
Deleted Records:
The Recycle Bin link in the sidebar lets you view and restore recently deleted
records for 15
days before they are permanently deleted. If your organization reaches its
Recycle Bin limit,
Salesforce automatically removes the oldest records if they have been in the
Recycle Bin for at
least two hours. Your organization can have up to 5,000 records per license in
the Recycle
Bin
at any one time. For example, if your organization has five user licenses, 25,000
records can
be stored in the Recycle Bin.
Deleted Fields:
Deleted custom fields and their data are stored until your organization
permanently deletes
them or 15 days has elapsed, whichever happens first. Until that time, you can
restore the
field
and its data. However, the field still counts against the maximum number of
custom fields
allowed in your organization.
Standard fields can not be deleted ONLY customer fields of standard
or custom
object
can be deleted.
Deleted Objects:
When you delete a custom object, Salesforce does not add it to the Recycle Bin.
Instead,
deleted objects appear in the Deleted Objects list for 15 days. During this time, the
object
and its data are soft deleted, meaning you can restore or permanently erase (hard
delete)
the object and its data. After 15 days, the object and its data are automatically
hard
deleted.
14. What is schema builder? Can we create objects & relationships
99
using schema
builder?
Schema Builder provides a dynamic environment to add new custom objects,
custom
fields, and relationships to your schema. This eliminates the need to click from
page to
page to find the details of a master-detail relationship or to add a new custom field
to an
object in your schema. For example, if youre using Schema Builder to view the
details of
your schema, you can add a new custom object without leaving Schema Builder.
The draganddrop
interface lets you easily add a custom object or new field, and saves the layout of
your schema any time you move an object.
Schema Builder provides details such as the field values, required fields, and how
objects
are related by displaying lookup and master-detail relationships. You can view the
details
for both standard and custom objects in Schema Builder.
Schema Builder is enabled by default and lets you add the following to
your
schema:
Custom objects
Lookup relationships
Master-detail relationships
15. What do you mean by Hierarchical Relationship and explain?
Hierarchical Relationship allows users to click a lookup icon and select another
user from a
popup list.
Its exactly like a Lookup relationship, except the only things that are "special"
about
this type of relationship are:
It's only available on the User object where Lookup or Master/Detail are not.
It can only look up to the User object.
Type of relationship are easy ways to get:
- a user's complete upstream hierarchy (List)
- a user's complete downstream hierarchy (tree structure and/or Set)
- Determine if a user is in another user's upstream and distance
Determine if a user is in another user's downstream and distance
Wrapper Classes:
100
In the Visualforce community boards one of the most commonly asked questions
is, "How can I display a table of records with a check box and then process only
the records that are selected?", like this:
return contactList;
}
public PageReference processSelected() {
//We create a new list of Contacts that we be populated only with
Contacts if they are selected
List<Contact> selectedContacts = new List<Contact>();
//We will cycle through our list of cContacts and will check to see if the
selected property is set to true, if it is we add the Contact to the selectedContacts
list
for(cContact cCon: getContacts()) {
if(cCon.selected == true) {
selectedContacts.add(cCon.con);
}
}
// Now we have our list of selected contacts and can perform any type
of logic we want, sending emails, updating a field on the Contact, etc
System.debug('These are the selected Contacts...');
for(Contact con: selectedContacts) {
system.debug(con);
}
contactList=null; // we need this line if we performed a write operation
because getContacts gets a fresh list now
return null;
}
// This is our wrapper/container class. A container class is a class, a data
structure, or an abstract data type whose instances are collections of other objects.
In this example a wrapper class contains both the standard salesforce object
Contact and a Boolean value
public class cContact {
public Contact con {get; set;}
public Boolean selected {get; set;}
//This is the contructor method. When we create a new cContact object
we pass a Contact that is set to the con property. We also set the selected value to
false
102
public cContact(Contact c) {
con = c;
selected = false;
}
}
103
104
2. What is Apex
b. Web Services
c. Email Services
d. Batch Classes
e. Schedulable Classes
f. Test Class
g. Controller Classes for Visualforce pages
5. What is a class and explain in detail?
Apex classes are similar to Java classes.
105
private
This is the default, and means that the method or variable is accessible only
within the Apex class in which it is defined. If we do not specify an access
modifier, the method or variable is private.
protected
This means that the method or variable is visible to any inner classes in the
defining Apex class. We can only use this access modifier for instance
methods and member variables. Note that it is strictly more permissive than
the default (private) setting, just like Java.
public
This means the method or variable can be used by any Apex in this
application or namespace.
global
This means the method or variable can be used by any Apex code that has
access to the class, not just the Apex code in the same application. This
access modifier should be used for any method that needs to be referenced
outside of the application, either in the SOAP API or by other Apexcode. If
we declare a method or variable as global, we must also declare the class
that contains it as global.
7. What is an Object?
106
is
the
scope
of
static
variable?
When you declare a method or variable as static, its initialized only once
when a class is loaded. Static variables arent transmitted as part of the view
state for a Visualforce page.
Static variables are only static within the scope of the request. They are not
static across the server, or across the entire organization.
12.What are the Keywords in SalesForce?
Apex has the following keywords available:
final
instanceof
107
super
this
transient
with sharing and without sharing
13. Explain with sharing and without sharing key words?
Apex generally runs in system context; that is, the current user's
permissions, field-level security, and sharing rules arent taken into account
during code execution.
Because these rules aren't enforced, developers who use Apex must take
care that they don't inadvertently expose sensitive data that would normally
be hidden from users by user permissions, field-level security, or
organization-wide defaults. They should be particularly careful with Web
services, which can be restricted by permissions, but execute in system
context once they are initiated.
Use the with sharing keywords when declaring a class to enforce the sharing
rules that apply to the current user.
14.What is an Interface?
An interface is a named set of method signatures (the return and parameter
definitions), but without any implementation.
Interfaces provide a layer of abstraction to your code. They separate the
specific implementation of a method from the declaration for that method.
This way, you can have different implementations of a method based on
your specific application.
15. What is a Sub class?
Apex supports subclasses, allowing you to create a class that extends
another class. The subclass inherits all the functionality of that parent class.
It can also have additional methods and member variables, and can override
the behavior of existing parent class methods.
16.What are Primitive Data Types in APEX Language?
Apex has a number of primitive data types. These are used to store data at
run time.
String: Strings are set of characters and are enclosed in single quotes. They
store text values such as a name or an address.
Integer, Long, Double and Decimal: Variables declared with any of
these data types hold numeric values.
108
Time, Date and Datetime: Variables declared with any of these data
types hold time, date, or time and date values combined
Boolean: Boolean values hold true or false values and you can use them to
test whether a certain condition is true or false
17. What is ID data type?
The ID data type represents an 18-character an object identifier. Force.com
sets an ID to a object once it is inserted into the database. For example, an
ID value can be a02D0000006YLCyIAO.
18.
What are Collection Objects?
Apex has the following types of collections:
Lists
Maps
Sets
A list is a collection of elements, such as Integers, Strings, objects, or other
collections.
List holds an ordered collection of objects.
Use a list when the sequence of elements is important. List can have
duplicate elements .
The index position of the first element in a list is always 0.
A set is an unordered collection of elements that do not contain any
duplicates. Set elements can be of any data typeprimitive types,
collections, sObjects, user-defined types, and built-in Apex types.
Apex uses a hash structure for all sets.
A set is an unordered collection. Do not rely on the order in which set results
are returned. The order of objects returned by sets may change without
warning.
A map is a collection of key-value pairs where each unique key maps to a
single value. Keys and values can be any data typeprimitive types,
collections, sObjects, user-defined types, and built-in Apex types.
19.What is a SObject?
sObject is a generic abstract type that corresponds to any persisted object
type. The generic sObject can be cast into a specific sObject type, such as an
account
An sObject is any object that can be stored in the Force.com platform
database. These are not objects in the sense of instances of Apex classes;
rather, they are representations of data that has or will be persisted.
sObject s = new Account();
109
20.
What are different DML Methods in SalesForce?
Data Manipulation Language (DML) methods help to perform different
data base transactions/operations.
SalesForce supports DML Statements like insert, update, delete, undelete.
This is called APEX DML Statements
Alternatively, SalesForce supports Database DML Statements. we can
perform DML operations by calling the methods provided by the Database
class.
Database.insert
Database.delete
21. What is the difference between database.insert and insert ?
23.
Locking Statements
110
Apex allows you to lock an sObject record to prevent other code from
making changes to it. Use the FOR UPDATE SOQL statement to lock a
record.
24.
What is an Exception?
Exceptions note errors and other events that disrupt the normal flow of
code execution. Throw statements are used to generate exceptions, while
try, catch, and finally statements are used to gracefully recover from
exceptions.
The advantage of using exceptions is that they simplify error handling.
Exceptions bubble up from the called method to the caller, as many levels
as necessary, until a catch statement is found that will handle the error.
using finally statements, we have one place to recover from exceptions, like
resetting variables and deleting data.
When an exception occurs, code execution halts and any DML operations
that were processed prior to the exception are rolled back and arent
committed to the database. Exceptions get logged in debug logs. For
unhandled exceptions, that is, exceptions that the code doesnt catch,
Salesforce sends an email to the developer with the organization ID and user
ID of the running
user, as well as the exception message.
If you run into an exception that occurred in Apex code while using the
standard user interface, an error message appears on the page showing you
the text of the unhandled exception
25.
Explain Try, Catch and
Finally Statements in SalesForce?
Apex uses try, catch and finally statements to handle exceptions.
The try statement identifies a block of code in which an exception can occur.
If you have code that you think could generate an exception, wrap this
section of your code in a try block, and add a catch block after it. Only
exceptions thrown from the code wrapped in the try block are handled by
the catch block.
The catch statement identifies a block of code that handles a particular type
of exception. In the previous example, notice that there are two catch
statements. You can have as many catch statements as you like, one for each
exception type you want to catch.
111
The finally statement is optional and gets executed after the catch block
executes. Code in the finally block always executes regardless of the type of
exception that was thrown and handled. You can add any final clean up code
here.
26.
Exceptions?
DML Exception
List Exception
NullPointerException
QueryException
SObjectException
27.
How to create Custom
Exception?
To create custom exception class, extend the built-in Exception class and
make sure class name ends with the word Exception. Append extends
Exception after class declaration
public class MyException extends Exception {}
28. What are different annotations in SalesForce?
@Future
@IsTest
@ReadOnly
@RemoteAction
@TestVisible
Apex REST annotations:
@RestResource(urlMapping='/yourUrl')
@HttpDelete
@HttpGet
@HttpPatch
@HttpPost
@HttpPut
29.
System.runAs()
Generally, all Apex code runs in system mode, and the permissions and
record sharing of the current user are not taken into account. The system
method, System.runAs(), lets you write test methods that change user
contexts to either an existing user or a new user. All of that users record
sharing is then enforced. You can only use runAs in a test method.
The original system context is started again after all runAs() test methods
complete.
Example :
1
2
3
4
5
System.runAs(u) {
// The following code runs as user 'u'
System.debug('Current User: ' + UserInfo.getUserName());
System.debug('Current Profile: ' + UserInfo.getProfileId());
// Run some code that checks record sharing
}
114
What is a Trigger?
Triggers are Apex code that execute before or after an insert, update, delete
or undelete event occurs on an sObject.
A trigger always starts with the trigger keyword, followed by the name of the
trigger, the database object to which the trigger should be attached to, and
then the conditions under which it should fire
trigger triggerName on ObjectName (trigger_events) {
code_block
}
The events you can specify are:
before insert
before update
before delete
after insert
after update
after delete
after undelete
36.
What is the difference between trigger.new and trigger.old
in Apex SFDC?
116
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.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.
37. How to restrict any Trigger to fire only once?
Or What is
Recursive Triggers?
You want to write a trigger that creates a new record as part of its processing
logic; however, that record may then cause another trigger to fire, which in
turn causes another to fire, and so on. You don't know how to stop that
recursion.
The before and after triggers fire one more time only if something needs to be
updated. If the fields have already been set to a value, the triggers are not fired
again.
Workaround:
Create a Helper Class, with a static Boolean variable.
Check its value within the affected triggers.
After the trigger is executed , set the Boolean to True.
38. In class declaration if we dont write keyword with sharing
then it runs in system mode then why keyword without sharing
is
introduced
in
apex?
Lets take example, there is classA declared using with sharing and it
calls classB method. classB is not declared with any keyword then by
default with sharing will be applied to that class because originating call
is done through classA. To avoid this we have to explicitly define classB with
keyword without sharing.
39. What
is
Scheduler
class
in
Apex?
named
execute().
There are two ways to invoke scheduler :
1. Using UI
2. Using System.schedule
The class which implements interface schedulable get the button texted with
Schedule, when user clicks on that button, new interface opens to schedule
the
classes
which
implements
that
interface.
To see what happened to scheduled job, go to Monitoring | Scheduled
jobs
40.
What is difference in ISNULL and ISBLANK?
ISNULL:
Determines if an expression is null (blank) and returns TRUE if it is.
If it contains a value, this function returns FALSE.
Text fields are never null, so using this function with a text field always
returns false. For example, the formula field IF(ISNULL(new__c) 1, 0)
is always zero regardless of the value in the New field. For text fields, use
the ISBLANK function instead.
Multi-select picklist fields are never null in s-controls, buttons, and
email templates, so using this function with a multi-select picklist field
in those contexts always returns false.
Empty date and date/time fields always return true when referenced
in ISNULL functions.
Choose Treat blank fields as blanks for your formula when referencing
a number, percent, or currency field in an ISNULL function. Choosing
Treat blank fields as zeroes gives blank fields the value of zero so none of
them will be null.
Merge fields can be handled as blanks, which can affect the results of
components like s-controls because they can call this function.
When using a validation rule to ensure that a number field contains a
specific value, use the ISNULL function to include fields that do not
contain any value. For example, to validate that a custom field contains
a value of 1, use the following validation rule to display an error if the
field is blank or any other number: OR(ISNULL(field__c), field__c<>1)
118
ISBLANK:
Determines if an expression has a value and returns TRUE if it does
not. If it contains a value, this function returns FALSE.
Use ISBLANK instead of ISNULL in new formulas. ISBLANK has
is
the
dynamic
Apex?
43. Where
to
write
Visualforce
code
In Apex use below code to create the error message for visualforce.
1
120
Apexpages.addMessage(
new
ApexPages.Message
(ApexPages.Severity.ERROR,'Required fields are missing. '));
in Visualforce page add below tag where you want to display the error
message.
<apex:pageMessages ></apex:pageMessages>
46. What
is
the
controller
extension?
50. What
is
S-Control
?
Ans: S-Controls are the predominant salesforce.com widgets which are
completely based on Javascript. These are hosted by salesforce but executed
at client side. S-Controls are superseded by Visualforce now.
of
visualforce?
are
the
types
of
controller
in
visual
force?
In spring 12, Salesforce has come up with ability of SOQL to get records from
position X instead of position 1 every time to help creating pagination
feature
56.
Difference
between
Sandbox
and
Development
environment?
A test environment for salesforce.com is crucial to change control.
Salesforce.com provides the tools needed to test anything in a test
environment before you implement it in your live instance. You can either
test in a Sandbox environment or in a Developer environment. What is the
difference? I will share what I know
Sandbox
The salesforce.com Sandbox environment is an exact copy of your
salesforce.com instance. You can copy your live instance to a sandbox
environment (but you have to perform manually from sandbox to developer
edition) where you can test any changes, implementations, AppExchange
apps or updates. It can also be your hands-on training environment without
risking your live data.
You can either copy your configuration and data into a sandbox
environment or just the configuration. It acts exactly like your live instance,
123
but be careful if you have workflow rules or automations because they will
work in the sandbox as well.
I know that this sounds wonderful and if you dont have it, you are dying to
know how to get it. The problem is the cost. If you are on Unlimited Edition,
then cost is not a problem because it comes included. But for Enterprise,
Professional or Group Editions, you have to pay and the price is hefty;
anywhere between 25k-50k per year. For a lot of companies, that is more
than they are paying for their live salesforce.com instance. So how do you
test salesforce.com without Sandbox? It is always suggested to develop
application in sandbox instance then go for LIVE.
Developer Edition
Developer Edition was an edition created for development of integrations
and apps, specifically for the AppExchange. It is also a great tool for
testing/training in salesforce.com. What makes this a great tool is the fact
that it is free. Anyone can get a Developer Edition of salesforce.com. It is a
standard Enterprise Edition with very limited storage space. You cannot
copy your configuration or data onto the Developer Edition, but you can
customize it to match your instances look and feel. Once it is customized,
you can use it for training, testing or anything else you want. It takes a little
bit of work, but you can make it act and feel just like your live instance. The
work is well worth it for the free price.
57.
How to get the list of all available sobject in salesforce
database using Apex (Dynamic Apex)?
Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe();
58.
Dynamic
124
Apex.
Map<String,
Schema.SObjectType>
Schema.getGlobalDescribe();
gd
1 Map<String,
Schema.SObjectType>
Schema.getGlobalDescribe() ;
2 Schema.SObjectType s = m.get('API_Name_Of_SObject') ;
3 Schema.DescribeSObjectResult r = s.getDescribe() ;
4 Map<String,Schema.SObjectField> fields = r.fields.getMap() ;
60. How to get all the required fields of sObject dynamically?
to
get
the
picklist
value
in
Apex
class?
Using Dynamic apex, we can achieve this.on object of type pickilist, call
getDescribe(). then call thegetPicklistValues() method. iterate over
result and create a list. bind it to <apex:selectOptions>.
62. What
is
the
custom
settings?
of
the
custom
settings?
List
Custom
Settings
A type of custom setting that provides a reusable set of static data that can
be accessed across your organization. If you use a particular set of data
frequently within your application, putting that data in a list custom setting
streamlines access to it. Data in list settings does not vary with
profile or user, but is available organization-wide. Examples of list
data include two-letter state abbreviations, international dialing prefixes,
and catalog numbers for products. Because the data is cached, access is lowcost and efficient: you dont have to use SOQL queries that count against
your governor limits.
Hierarchy
Custom
Settings
A type of custom setting that uses a built-in hierarchical logic that lets you
personalize settings for specific profiles or users. The hierarchy logic
checks the organization, profile, and user settings for the current user and
returns the most specific, or lowest, value. In the hierarchy, settings for an
organization are overridden by profile settings, which, in turn, are
overridden by user settings
64. Other than SOQL and SOSL what is other way to get custom
settings?
126
Other than SOQL or SOSL, Custom seting have their own set of methods to
access
the
record.
For example : if there is custom setting of name ISO_Country,
1
SO_Country__c code = ISO_Country__c.getInstance(INDIA);
2
//To return a map of data sets defined for the custom object (all
records in the custom object), //you would use:
3
Map<String,ISO_Country__c>
mapCodes
=
ISO_Country__c.getAll();
4
// display the ISO code for India
5
System.debug(ISO Code: +mapCodes.get(INDIA).ISO_Code__c);
6
//Alternatively you can return the map as a list:
7
List<String> listCodes = ISO_Country__c.getAll().values();
65.
What is a Callout?
Callouts enable Apex to invoke external web or HTTP services. Apex Web
services allow an external application to invoke Apex methods through Web
services.
Apex provides integration with Web services that utilize SOAP and WSDL,
or HTTP services (RESTful services).
66.
Before any Apex callout can call an external site, that site must be registered
in the Remote Site Settings page, or the callout fails. Salesforceprevents
calls to unauthorized network addresses.
To add a remote site setting:
a. From Setup, click Security Controls | Remote
Settings.
b. Click New Remote Site.
c. Enter a descriptive term for the Remote Site Name.
d. Enter the URL for the remote site.
e. Optionally, enter a description of the site.
f. Click Save.
Site
67.
What is REST API?
Representational State Transfer (REST) is a style of software architecture
for distributed hypermedia systems such as the World Wide Web.
127
68. What is the default timeout period while calling webservice from
Apex.
10 sec.
69. A single Apex transaction can make how many callouts to an
HTTP
request
or
an
API
call?
Maximum 10 callouts
70. How to increase timeout while calling web service from Apex ?
docSample.DocSamplePort stub = new docSample.DocSamplePort();
stub.timeout_x = 2000; // timeout in milliseconds
71. How to force lead assignment rule via Apex while updating or
adding
the
Lead?
To enforce Assignment Rules in Apex you will need to perform following
steps:
1. Instantiate the Database.DMLOptions class.
2. Set the useDefaultRule property of assignmentRuleHeader to True.
3. Finally call a native method on your Lead called setOptions, with the
Database.DMLOptions instance as the argument.
72. How
to
convert
lead
using
Apex?
Lead myLead = new Lead(LastName = 'Foo', Company='Foo Bar');
insert myLead;
lc.setLeadId(myLead.id);
7
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM
LeadStatus WHERE IsConverted=true LIMIT 1];
8
lc.setConvertedStatus(convertStatus.MasterLabel);
10
11
System.assert(lcr.isSuccess());
128
129
A profile contains user permissions and access settings that control what users
can do within their organization
Object permissions that allow users to create, read, edit, and delete
records
Permissions that allow users to manage the system and apps within it
The hours during which and IP addresses from which users can log in
130
Private
Public Read Only
Public Read Write
You use organization-wide sharing settings to lock down your data to the
most restrictive level, and then use the other record-level security and
sharing tools to selectively give access to other users. For example, lets
say users have object-level permissions to read and edit opportunities,
and the organization-wide sharing setting is Read-Only. By default,
those users can read all opportunity records, but cant edit any unless
they own the record or are granted additional permissions.
Role hierarchyOnce youve specified organization-wide sharing
settings, the first way you can give wider access to records is with a role
hierarchy. Similar to an organization chart, a role hierarchy represents a
level of data access that a user or group of users needs. The role hierarchy
ensures that users higher in the hierarchy always have access to the same
data as people lower in their hierarchy, regardless of the organizationwide default settings. Role hierarchies dont have to match your
organization chart exactly. Instead, each role in the hierarchy should
represent a level of data access that a user or group of users needs.
You can also use a territory hierarchy to share access to records. A
territory hierarchy grants users access to records based on criteria such
as zip code, industry, revenue, or a custom field that is relevant to your
business. For example, you could create a territory hierarchy in which a
user with the North America role has access to different data than users
with the Canada and United States roles.
Note
Although its easy to confuse permission sets and profiles with roles, they
control two very different things. Permission sets and profiles control a
users object and field access permissions. Roles primarily control a
users record-level access through role hierarchy and sharing rules.
Sharing rulesSharing rules let you make automatic exceptions to
organization-wide sharing settings for particular sets of users, to give
them access to records they dont own or cant normally see. Sharing
rules, like role hierarchies, are only used to give additional users access
to recordsthey cant be stricter than your organization-wide default
settings.
Manual sharingSometimes its impossible to define a consistent
group of users who need access to a particular set of records. In those
situations, record owners can use manual sharing to give read and edit
permissions to users who would not have access to the record any other
way. Although manual sharing isnt automated like organization-wide
132
5.
6.
7.
8.
Unlimited
800
25
50
300
500
300
2000
Unlimited
2
20
3900 characters (4KB)
500
Web to Case
Roles
Field Filters Per Report
Formulas Per Report
5000
500
20
5
5000
500
20
5
Limit
100
200
50,000
20
200
150
10,000
200,000
1,000,000
6MB
12MB
16
30
200
10
120
seconds
10 seconds
10
3MB
10
100
25
136
Prevent
137
Use
3.
What
is
a
Visualforce
Page
?
Ans: Visualforce is the new markup language from salesforce, by using which, We
can render the standard styles of salesforce. We can still use HTML here in
Visualforce. Each visualforce tag always begins with apex namespace. All the
design part can be acomplished by using Visualforce Markup Language and the
business logic can be written in custom controllers associated with the Page.
4. Will Visual force still supports the merge fields usage like S-control ?
Ans: Yes. Just like S-Controls, Visualforce Pages support embedded merge fields,
like the {!$User.FirstName} used in the example.
5.
Where
to
write
Visualforce
Ans: You can write the code basically in 3 ways.
code
6.What
are
Apex
Governor
Limits?
Governor limits are runtime limits enforced by the Apex runtime engine. Because
Apex runs in a shared, multitenant environment, the Apex runtime engine strictly
enforces a number of limits to ensure that code does not monopolize shared
resources. Types of limits that Apex enforces are resources like memory, database
resources, number of script statements to avoid infinite loops, and number of
records being processed. If code exceeds a limit, the associated governor issues a
runtime
exception.
1. Master Detail
2. Many to Many
3. Lookup
4. Hierarchical
For further study read this.
19. How to create many to many relationships between object?
Creating many to many relationship in salesforce is little tricky. You cannot create
this type of relationship directly. Follow below steps to create this type of
relationship.
Create both objects which should be interlinked.
Create one custom object (also called as junction object), which should have
autonumber as unique identification and create two master relationships for
both objects, no need create tab for this object.
Now on both object, add this field as related list.
20. In Which sequence Trigger and automation rules run in
Salesforce.com The following is the order salesforce logic is applied to a record.
1. Old record loaded from database (or initialized for new inserts)
2. New record values overwrite old values
3. System Validation Rules
4. All Apex before triggers (EE / UE only)
5. Custom Validation Rules
6. Record saved to database (but not committed)
7. Record reloaded from database
8. All Apex after triggers (EE / UE only)
9. Assignment rules
10.
Auto-response rules
11.
Workflow rules
12.
Escalation rules
13.
Parent Rollup Summary Formula value updated (if present)
14.
Database commit
15.
Post-commit logic (sending email)
Additional notes: There is no
execution within each group above.
way
to control
the
order
of
SFDC?
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.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.
26. How to restrict any Trigger to fire only once ?
Ans:
Triggers can fire twice, once before workflows and once after workflows, this is
documented
at
http://www.salesforce.com/us/developer/docs/apexcode/
Content/
143
apex_triggers_order_of_execution.htm:
The before and after triggers fire one more time only if something needs to be
updated. If the fields have already been set to a value, the triggers are not fired
again.
Workaround:
Add a static boolean variable to a class, and check its value within the affected
triggers.
1 public class HelperClass {
2 public static boolean firstRun = true;
3}
4 trigger affectedTrigger on Account (before delete, after delete, after undelete) {
5 if(Trigger.isBefore){
6
if(Trigger.isDelete){
7
if(HelperClass.firstRun){
8
Trigger.old[0].addError('Before Account Delete Error');
9
HelperClass.firstRun=false;
10
}
11
}
12 }
13 }
27. What is difference between WhoId and WhatId in the Data Model
of
Task
?
Ans
:
WhoID refers to people things. So that would be typically a Lead ID or a Contact
ID
WhatID refers to object type things. That would typically be an Account ID or an
Opportunity
ID
Check Data Model of task here
28. Where is the option of the report for the Custom Object with
related object and what are the condition to generate related reports?
Ans
:
If the parent object is the standard object provided by the salesforce like Account,
Contact then the report will be in there section with related custom object.
If both objects are the custom then the report will be in Other Reports
144
Sections.
Following are the conditions to get the report of related objects:
On both the objects, Reports option must be enable.
The relationship between both of them must be Master detail
relationship.
Read this article, to get detailed idea on this topic.
29. How you can provide the User Login (Authentication) in Public
sites
created
by
Salesforce.
Answer : We can provide the authentication on public sites using Customer
Portal.
includes
editions
Manager
edition
edition
145
Unlimited
edition
Enterprise
edition,
Unlimited
edition.
Outlook connect to sales force is used to sync contacts, Events and mails to sales
force. Like mobile lite feature this is also available in all above mentioned editions.
What
is
app
exchange?
The developed custom applications can be uploaded into the app exchange so that
the
other
person
can
share
the
applicaition.
What
is
a
VLOOKUP
in
S.F?
VLOOKUP is actually a function in sales force which is used to bring relevant value
to
that
record
from
another
record
automatically.
What are the types of bindings available in Visual force?
Using get; set in apex, we can bind variables in visual force.
ex:
public
String
textdemo{get;set;}
//
in
apex
<apex:input
text
value={!textdemo}>
Using
Ex:
methods
in
controller
<apex:selectlist
value=textdemo>
<apex:selectoptions
value=listt/>
</apex:selectoptions>
//In
Public
Return
[select
}
What are
4
Master-Detail
Lookup
Junction
Hierarchy
the
List<Account>
Id,Name
from
Account];
types
of
relationships
\\
apex
getlistt(){
returns
list
present
in
S.F?
types
Object
What
is
junction
Object
and
what
does
it
mean?
Junction object is a custom object which is used to create many to many
relationship
between
two
objects.
It
always
contains
two
Master-Detail
relationships.
Differences
between
Master-Detail
and
Lookup
Both are used to create one to many relationship between two objects.
147
In
In
case
case
deleted.
deleted.
148
is
Field
level
Security?
Giving
permissions
to
users
based
on
Profiles.
Mentioning the availibity of a field to the users for viewing and editing purpose
based
on
profile
is
called
field
level
security.
While creating a field,we can mention the security level of that field fr every profile
by
deciding
its
level
of
accessibility
to
each
profile.
Difference
between
Formula
and
Roll-up
summary
Formula: is a read only field that derives a value from a formula expression that
we
define.
Roll-up summary: A read-only field that displays the sum, minimum, or
maximum value of a field in a related list or the record count of all records listed
in
a
related
list.
Difference
IsNull
IsBlank-
btw
it
it
isNull
supports
supports
for
for
and
Number
Text
isBlank
field.
field.
time
triggers.
Actions:
Task
:
Asign
a
new
task
to
user.
Email-alerts : Send email to one or more recipients that are specified.
Field
Updates
:
Update
value
of
a
field.
Outbound Messages: Send a configurable API message to designed listener.
Types
Text
Html
Custom
Visual
of
with
templates
letter
head
Template
Force.
Difference
btw
Profiles
and
Roles
Profiles: Field level or Object level security can be given by profiles
Roles:
Record
level
security
can
be
given
by
Roles.
Profile
is
Types
Manual
OWD
Public
Public
Private
Sharing
Role
mandatory.
in
roles:
Sharing
(organization
wide
default):
read
read/write
rules
Hierarchy
What
is
a
wrapper
class?
A wrapper class is a class whose instances are collections of other objects.
What
are
collections
and
types
of
collections?
Collection is an object which groups multiple elements into a single unit.
List:
Ordered
collection
of
elements
which
allows
duplicates.
Set: Unordered collection of elements which do not allow duplicates.
Map: Pair of two elements, in which the first element is always unique.
150
Types
of
Reports:
Tabular: Display data in a tabular form. No summarizing is allowed.
Summary: Summarize data on one column based on single criteria.
Matrix:
Summarize
data
on
both
row
and
columns.
Difference
between
VF
VF
and
S-Control
S-Control
Current
Page
Object
Page
Reference
Type
Component
What
is
a
Page
Reference?
Page reference is a class in apex, which is used to redirect to another page.
By creating an object to this class, we can use this object to forward to another
page
as
shown
in
example
below:
Public
Pagereference
go()
{
Pagereference p = new pageReference(http://www.google.com);
Return
p;
}
What
is
151
MVC?
The main aim of the MVC architecture is to separate the business logic and
application
data
from
the
presentation
data
to
the
user.
Model: The model object knows about all the data that need to be displayed.
View: The view represents the presentation of the application (User Interface).
Controller:
Actual
business
logic
of
VF
is
present
here.
What
are
the
Controllers
available
in
Force.com?
3
types
of
controllers
are
available
Standard Controller: Used for both custom and standard objects.
Custom Controller: is an apex class that implements all the logic for a page
without
leveraging
the
functionality
of
a
standard
controller.
Extension Controller: is an apex class which adds functionality to existing
standard
and
custom
controllers.
What is a difference between render, rerender and renderAs?
Render: is an attribute used in VF to hide or show certain components in visual
force
page.
Rerender: Used to refresh a part of a page in visual force page when an action
occurs.
Render as: Used to convert entire visual force into PDF
Render
as
=
pdf.
How can you access URL Parameters in to a visual force page?
Using $CurrentPage, you can access the query string parameters for the page by
specifying the parameters attribute, after which you can access each individual
parameter.
$CurrentPage.parameters.parameter_name
Ex:
$CurrentPage.parameters.location
What
are
annotations
ant
their
types?
Annotations are used to bypass the methods in the way they execute.
@Future:
Used
to
execute
the
methods
asynchronously.
@IsTest:
Used
to
test
the
methods.
@ReadOnly
@Deprecated
@Remote
Action
What
is
difference
between
152
<apex:
dataTable
/>,
<apex:
pageBlockTable
Only
standard
If we want to
What
is
Sandbox
is
3
Configuration
Developer
Full
style
sheets
used
in
page
add custom style sheets we have
a
the
Sandbox?
Types
exact
replica
of
of
the
block
to data
/>?
table,
table.
sandbox.
production.
Types:
What
are
triggers?
Types
of
Triggers
Trigger is a piece of code that is executed before or after a particular field of certain
type
is
inserted,
updated
or
deleted.
Bulk Trigger: All triggers are bulk triggers by default, and can process multiple
records at a time. You should always plan on processing more than one record at
a
time.
Bulk triggers can handle both single record updates and bulk operations like:
Data
import
Mass
actions,
such
as
record
owner
changes
and
deletes
Recursive Apex methods and triggers that invoke bulk DML statements.
Recursive
trigger:
ActionSupport: A component that adds AJAX support to another component,
allowing the component to be refreshed asynchronously by the server when a
particular event occurs, such as a button click or mouseover.
ActionFunction: A component that provides support for invoking controller
action methods directly from JavaScript code using an AJAX request.
ActionPoller: A timer that sends an AJAX update request to the server
according
to
a
time
interval
that
you
specify.
What is Batch Apex? How can you implement Batch Apex?(Dynamic
Apex)
Batch Apex gives you the ability to operate over large amounts of data by chunking
the job into smaller parts, thereby keeping within the governor limits.
Using batch Apex, you can build complex, long-running processes on the
Force.com platform. For example, you could build an archiving solution that runs
on a nightly basis, looking for records past a certain date and adding them to an
archive.
What is a Callout method? How does it invoke, how many methods
available
in
Classes
and
Triggers?
153
Supports
LMA
for
Managing
Installs
When
to
Use
1:1
Distribution
Extensive
Modification
Required
1:Many
Distribution
Commerical
Intent
Foresee
Upgrades
Editions Supported All Editions can create Unmanaged Packages ONLY
Developer
Edition
can
create
Managed
Packages
Managed packages differ from unmanaged packages in many other ways. Before
creating managed packages, here are a few things to consider:
You must use a Developer Edition organization to create and work with a
managed
package.
A Developer Edition organization can contain a single managed package and
many
unmanaged
packages.
You must register a Namespace Prefix - A Namespace Prefix is a series of
characters prefixed to your Custom Objects and Fields to prevent conflict when
installed
in
another
salesforce.com
org.
When you release a managed package, meaning it is uploaded with the Managed
- Released option selected, the properties of its components change to prevent
developers and installers from making harmful changes. For a list of each package
component type and their properties, see Properties of Managed Packages. If you
do not want to offer upgrades to your package, consider keeping it unmanaged.
If you plan to release your app as a Managed Package, please read out guide on
Planning
the
Release
of
Managed
Packages
If you already have a Unmanaged Package and you'd like to convert it to Managed,
please review the following: Converting Unmanaged Packages to Managed
Now that you understand the difference and benefits of each type of package, let's
see how easy it is to make your Unmanaged package from above into a Managed
Package.
Customer
portal
With Salesforce CRMs customer portal, your customers can log cases and get
updates 24x7. All via the intuitive user experience for which Salesforce CRM is
famous. The resulthigher customer satisfaction at a lower cost.
155
Partner
portal
Outsource your service management by allowing third-party service reps to
manage customer cases via the partner portal. Service partners can do everything
they need to resolve customer support issues: search the solution database, log
cases,
make
case
comments,
and
run
reports.
53.What are the rules Criteria to create a work flow? How many ways
to fire a work flows and when should those available? What are the
actions
in
work
flow?
Ans. Criteria that cause salesforce.com to apply the workflow rule.
Immediate actions that execute when a record matches the criteria.
Time-dependent actions that salesforce.com queues when a record matches the
criteria,
and
executes
according
to
time
triggers.
In
2
ways,
1. Immediate action: when criteria matches record then workflow will be fired
immediately.
2.
Timedependent
action:
Fires
according
to
time
triggers.
Tasks - Assign a new task to a user, role, or record owner.
Email Alerts - Send an email to one or more recipients you specify.
Field Updates - Update the value of a field on a record.
Outbound Messages - Send a secure configurable API message (in XML format)
to a
designated listener.
54. Types of Sandboxes and what are those and In Which editions
those
are
available?
Ans. 3 types of Sandboxes available, those are Developer, Full and Configuration.
In
all
editions.
55. What is test coverage code % for the classes and triggers and what
is
the
test
method
syntax?
Ans.
75%.
56.Types
of
Triggers
and
what
is
a
Bulk
Trigger?
Ans. All triggers are bulk triggers by default, and can process multiple records at
a time. You should always plan on processing more than one record at a time.
Bulk triggers can handle both single record updates and bulk operations like:
Data
import
Bulk
Force.com
API
calls
Mass
actions,
such
as
record
owner
changes
and
deletes
Recursive Apex methods and triggers that invoke bulk DML statements.
156
7.
What identifies a controller as being an extension?
The controller must declare a constructor which takes another controller
explicitly.
For
example:
public
myControllerExtension(ApexPages.StandardController stdController) {this.acct
= (Account)stdController.getRecord(); }
8.
Why are properties helpful in controllers?
Properties can automatically create standard getters and setters while still
allowing for their customizations. They save you from both writing the tedious
code and reading the clutter when reviewing code.
9.
In what order do methods fire within a controller?
The only rule is that setters fire before action methods. Aside from that, there is
no guaranteed order.
10. What are some Apex classes that are commonly used within controllers?
StandardController, SelectOption, PageReference, Message, etc.
11. How are wizard controllers different from other controllers?
The two main issues is that they must handle multiple pages and they must
maintain the state across those pages.
12. What are the effects of using the transient key word?
The transient key word prevents the data from being saved into the view
state. This should be used for very temporary variables.
13. When is a component controller required for custom components?
A component controller is required when business logic is required to decide how
to render the component.
14. What kind of content can be included in a Visualforce page?
Any content that can be rendered in a browser (HTML, JavaScript, etc.).
15. What do {!expressions} refer to when used in Visualforce
components?
Expressions refer to either data or actions that are made available to the page from
the controller
16. What are the ways that Visualpages can be incorporated into the rest of your
user interface?
Basically, via links, buttons, tabs, and inline frames.
17. Is it always necessary to know Apex to create Visualforce pages? When does
it become necessary?
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.
18. What are attributes? What is the syntax for including them?
Attributes are modifiers to the main tag that belong after the tag name in the start
tag. The syntax is attributeName=attributeValue
19. What are three types of bindings used in Visualforce? What does each refer
to?
158
159
Class
100
Test
100
20
20
10000
500
200
200
10
10
10
10
3MB
1.5MB
161
Apex
1.
What is the biggest difference between Apex and most programming
languages?
and total number of page navigations, a client can do in a day, total data base
interactions that can be made in a single go.
Governor limits are based on the type of the Org we use.Generally, testing org
contains different governer limits(more), and production org contains different
governor limits(less).
4.
List a few characteristics of Apex that is different than other
programming
languages.
A. Apex is strongly typed language with direct references TO Sobject and fields
names.
Apex is interpreted, Executed, Controlled by Force.com platform.
Apex scripts can be saved against different versions of the Force.com API.
5.
How would an external program access functionality on Force.com platform?
We have a concept called Web Services. Using this extended functionality,
we can make external program access the functionality on Force.com platform.
We will generate WSDL document(Web Services Description Language) which
will be exposed to host environment which results in extending the capability of
accessing Force.com platform from external program.
6.
What are governor limits? Why are these important in a multitenant
environment?
A. Governor limits are the database limits that are applied to the users who use
Force.com platform. Governor limits simply means the limited database calls that
a
developer/user
do.
These governor limits are important because unlimited and free access to
database many number of times from each time will slow down the database
effectiveness.So,to preserve the database effectiveness, governor limits are
important in multi-tenant environment.
7.
What is Run time type information? How do obtain it in Apex?
A.
Run time type information refers to a system that keeps the information
about an objects data type in memory at run time. This run time information
deals to integers, strings and generic objects.
8.
How
do
you
override
a
method
in
Apex?
A.
With the help of the OVERRIDE key word in method signature, we can
override
a
method
in
Apex.
For example, we have a method public void abc(){
},
If we want to override the method, we can do like below:
Public override void abc(){
}
163
9.
What are the ways in which Apex can be invoked?
A. We can invoke apex in 4 ways:
a.
Triggers: By writing the apex triggers,and calling them on the 7 pre defined
events of creating/modifying a record, we can invoke apex.
b.
Apex Schedule: We can schedule Apex code to be run at a particular
point/for a particular period of time. We need to write some Apex code and
schedule them using Apex Scheduler.By this way, we can invoke apex.
c.
Anonymous Blocks: Anonymous Block refers to a block, from where we can
invoke apex by writing the logic we need. Example is as below:
d. Apex in Ajax: For Apex, we have ajax took kit, from where we can do Apex
calls. This Ajax toolkit can be used on the visualforce page using javascript
notations. Using this Apex in Ajax, we can invoke Apex.
10. What are some of the limitations of code that you can call via the
anonymous
block?
A.
Anonymous Blocks code execute with current users permission. So, if the
user does not have field-level permissions or does not have profile permissions,
then the code in anonymous block fails.
11. How do you expose functionality on Force.com to be consumed by
external
clients?
A.
We have a concept called Web Services. Using this extended functionality,
we can make external program access the functionality on Force.com platform.
We will generate WSDL document(Web Services Description Language) which
will be exposed to host
environment which results in extending the capability
of accessing Force.com platform from external program.
12. What would the syntax be to create a new class named
MyNewClass
which
should
be
public?
A.
Syntax
is:
Public class MyNewClass{
}
Here public is the access modifier for the class. And CLASS is the keyword to
designate a class and MyNewClass is the name of the class.
13. What is the difference between the global and public access
modifier
keywords?
A.
We have different access modifiers like global, private, public.
If we use the access modifier as Global, it can be used anywhere in the org.
Generally, Global is used for web-services since one class needs to handle some
other parts of apex in the org. Whenever we use Public keyword, then the access
is limited to the particular class and cannot be used outside the related class.
164
14.
1.5MB
Interview Questions:
1) Internalization or localization of salesforce?
- Currency
2) Many to Many
3) Consumption
4) Rollup Summary
5) Package import and export
6) Debug Log files
7) Primary Key and Foreign Key.
8) Report Schedule
9) Change Sets or Individual object Creation
Change set are used to move configurations from one system to the other (for
example... partial sandbox to full sandbox) BUT not the records
10) number of levels when you write query
When designing relationship queries, consider these limitations:
Relationship queries are not the same as SQL joins. You must have a relationship
between objects to create a join in SOQL.
No more than 35 child-to-parent relationships can be specified in a query. A
custom object allows up to 25 relationships, so you can reference all the child-toparent relationships for a custom object in one query.
No more than 20 parent-to-child relationships can be specified in a query.
In each specified relationship, no more than five levels can be specified in a childto-parent relationship. For example, Contact.Account.Owner.FirstName (three
levels).
11) Custom Report Type:
166
with or without
selective feilds
mail.setreplyto('[email protected]');
mail.setsenderdisplayname('Raveendra');
mail.setSubject('High Severity Cases has been created');
mail.setplaintextbody('Sev 1 case created.. Please assign to SME');
messaging.sendemail(new messaging.singleemailmessage[]{mail});
}
}
Create a trigger to make the record READ-ONLY when the field 'Active' (Active is
custom field, Active__C) is set to 'YES' for an account record?
trigger MakeRecordsReadOnlyWhenActiveIsSet on Account (before update) {
if(trigger.new[0].active__c == 'Yes')
trigger.new[0].adderror('Can not be updated');
}
Create a apex program to insert user?
public class TestStandardUserInsert {
public static void insertuser()
{
insert (new User(firstname = 'Vaishni Reddy 09-05-2015 06-11-45',lastName =
'Chintham',email = 'VaishniReddyChintham' + '@RNRITSolutions.com',
Username = 'VaishniReddyChintham' + '@RNRITSolutions.com',
EmailEncodingKey = 'ISO-8859-1',
Alias='Vaishni',
TimeZoneSidKey = 'America/Los_Angeles',
LocaleSidKey = 'en_US',
LanguageLocaleKey = 'en_US',
ProfileId = [select id from profile where name='Standard User'].id));
}
}
170
Test Class:
1) Why do I see below error message?
System.DmlException: Insert failed. First exception on row 0; first error:
UNKNOWN_EXCEPTION, portal account owner must have a role: []
Error Portal account owner must have a role
Description
System.DmlException: Insert failed. First exception on row 0; first error:
UNKNOWN_EXCEPTION, portal account owner must have a role: []
Resolution
This error is generated because the user was not assigned a role.
171
You will also see this same error (for the same reason) when trying to enable a
contact as a partner or customer portal user.
The
following
sample
code
demonstrates
how
to
avoid
this
error:
Which
sequence
Trigger
and
172
automation
rules
run
in
174
Visualforce page
Trigger
Web Services
Email Services
What are different DML Methods in SalesForce?
Data Manipulation Language (DML) methods help to perform different data base
transactions/operations.
SalesForce supports DML Statements like insert, update, delete, undelete. This is
called APEX
DML Statements
Alternatively, SalesForce supports Database DML Statements. We can perform
DML operations
by calling the methods provided by the Database class.
Database.insert
Database.update
Database.delete
176