You are on page 1of 227

Sales Force CRM

Consulting, Administrator &


Development – Course Material

By Rupom Chakraborty
V.4.1

Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad,
Telangana State, INDIA. Ph: 8686864286
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Module -01

Cloud Computing

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 1
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Cloud Computing
Cloud computing is the use of computing resources (hardware and software) that are
delivered as a service over a network (typically the Internet).

Cloud Computing History


➢ Cloud symbol was used to represent Internet till 1994
➢ Amazon Web Service (AWS) - 2006 (First Utility Based Cloud)
➢ Eucalyptus – 2008 (First open-source Cloud)
➢ Open Nebula - 2008 (First open-source software for deploying private and hybrid
clouds)

Cloud Characteristics
01. Agility: Improves users' ability to re-design technological infrastructure
resources as per requirement.
02. Application Programming Interface (API): Cloud software/hardware
should be programmable so as to customize and utilize the cloud resource.
03. Device and location independence: Enable cloud users to access systems
using a web browser regardless of their location or what device they are using (e.g.,
PC, mobile phone, PDA, Tablets Etc.). Many a time off –site, on Site model and
accessed via the Internet so as users can connect from anywhere.
04. Multitenancy: where a single instance of the software runs on a server,
serving multiple client organizations (tenants)
05. Centralization: Centralization of infrastructure, Data, Application Hosting
make efficient not only for delivery bu t also for maintenance.
06. Reliability: Delivery of data to the intended Cloud recipient(s) through reliable
and secure protocols only.
07. Scalability: All the cloud resources should be scalable and measured not only
on performance but also on usage, efficiency and on different measuring and quality
parameters.
08. Elasticity: Dynamic on demand provisioning of cloud resources so that in case
of increase of demand, the Cloud resource should be elastic as expandable to
accommodate all request without any delay or loss.
09. Performance: Cloud resource should be peak performance oriented to serve
all received request with efficiency.
10. Cost: Cloud deliver model should be available at the lowest of price incurring
saving for the organizations.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 2
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

11. Security: Centralization of data increased security-focused resources,


Implementing different security parameters and policies to make secure
organization Data.
12. Maintenance: Cloud computing applications should be easier to Install, Maintain
from user friendly administration panel.

Cloud Types
01. SaaS – Software as Service
02. PaaS – Platform as Service
03. IaaS – Infrastructure as Service

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 3
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Cloud Layers
Cloud has 4 Layers component :

➢ Client: A cloud client consists of computer hardware and/or computer software that
relies on cloud computing for application delivery and that is in essence useless
without it. Eg : Android, Web Browser, Smart Phones

➢ Application : This is the main cloud application or software Eg : SFDC , Google Apps,
MSCRM
➢ Platform: This component act as intermediately between Application and hardware,
specially meant for development, deployment or hosting. Eg : Amazon Web Services,
Azure Services Platform, Force.com

➢ Infrastructure: Providing communication and networking between all the needed


resource (Software or Hardware) of cloud together.

➢ Server: The server layer consists of computer hardware and/or computer software
products that are specifically designed for the delivery of cloud services, including
multi-core processors, cloud-specific operating systems and combined offerings.

Cloud Architecture Components


Cloud Service (Queue): The first point of contact for accessing cloud recourse is queue.
These are mostly web services API’s components.
Cloud Platform: Second point of contact where set of program receives, process or
further diverts the request.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 4
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Infra/Storage/HW: The physical devices where application, data is stored and


retrieved.

Cloud Components

Clients
Clients are the devices that the end users interact with to manage their information on the
cloud. Clients generally fall into three categories:
• Mobile Mobile devices include PDAs or smartphones, like a Blackberry, Windows
Mobile Smartphone, or an iPhone.
• Thin Clients are computers that do not have internal hard drives, but rather let the
server do all the work, but then display the information.
• Thick This type of client is a regular computer, using a web browser like Firefox or
Internet Explorer to connect to the cloud.
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 5
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Datacenter
The datacenter is the collection of servers where the application to which you subscribe is
housed. It generally includes redundant or backup power supplies, redundant data
communications connections, environmental controls (e.g., air conditioning, fire
suppression) and security devices.

Distributed Servers
A distributed system consists of multiple autonomous computers that communicate through
a computer network. The computers interact with each other in order to achieve a common
goal. A computer program that runs in a distributed system is called a distributed program,
and distributed programming is the process of writing such programs

Cloud Architecture Types


01. Grid Cloud Computing :- A form of distributed and parallel computing, whereby
a 'super and virtual computer' is composed of a cluster of networked, loosely coupled
computers acting in concert to perform very large tasks.

02. Utility Cloud Computing :- The packaging of computing resources, such as


computation and storage, as a metered service for a single goal.

03. Peer-to-peer Cloud Computing :- Distributed architecture without the need


for central coordination, with participants being at the same time both suppliers and
consumers of resources

04. Autonomic Cloud Computing :- A Self-Management cloud where computer


systems shall manage their own operation without human intervention.

05.Virtualize Cloud Computing : - Running of cloud resource in more than one


instance by utilizing the same HW.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 6
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Cloud Computing Deployment

Types of Clouds:
Cloud Computing can broadly be classified into 4 types. They are
• Private Cloud
• Public Cloud
• Community Cloud
• Hybrid Cloud

Private cloud : Private cloud is infrastructure operated solely for a single


organisation, whether managed internally or by a third-party and hosted internally or
externally.

Also referred to as internal cloud or on-premise cloud.


Private cloud scenarios

• On-site Private Cloud


Applies to private clouds implemented at a customer’s premises.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 7
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY












• Outsourced Private Cloud


Applies to private clouds where the server side is outsourced to a
hosting company.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 8
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Characteristics of a Private Cloud


• Heterogeneous infrastructure
• Customized and tailored policies
• Dedicated resources
• In-house infrastructure (capital expenditure cost model)
• End-to-end control
• Private cloud are more expensive
• Private cloud is more secure

Examples of Private Cloud


• Eucalyptus
• Ubuntu Enterprise Cloud - UEC (powered by Eucalyptus)
• Amazon VPC (Virtual Private Cloud)
• VMware Cloud Infrastructure Suite
• Microsoft ECI data center

Public Cloud : Public cloud describes cloud computing in the traditional mainstream
sense, whereby resources are dynamically provisioned to the general public on a fine-
grained, self-service basis over the Internet, via web applications/web services, from an off-
site third-party provider who bills on a fine-grained utility computing basis
Also known as external cloud or multi-tenant cloud.

Characteristics of a Public Cloud:


Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 9
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• Homogeneous infrastructure
• Common policies
• Shared
resources
and multi-
tenant
• Leased
or rented

infrastructure operational expenditure cost model


• Economies of scale
Examples of Public Cloud :
• Google App Engine
• Microsoft Windows Azure
• IBM Smart Cloud
• Amazon EC2
Community Cloud : The cloud infrastructure is shared by several organizations and
supports a specific community that has shared concerns (e.g., mission, security requirements,
policy, and compliance considerations). Government departments, universities, central
banks etc. often find this type of cloud useful.
Community cloud scenarios:
• On-site Community Cloud
o Applies to community clouds implemented on the premises of the
customers composing a community cloud

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 10
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• Outsourced Community

Cloud
o Applies to community clouds where the server side is
outsourced to a hosting company.

Examples of Community Cloud:


• Google Apps for Government
• Microsoft Government Community Cloud

Hybrid Cloud : Hybrid cloud is a composition of two or more clouds (private,


community, or public) that remain unique entities but are bound together, offering the
benefits of multiple deployment models. It can also be defined as a multiple cloud systems
that are connected in a way that allows programs and data to be moved easily from one
deployment system to another.
This deployment is also called as intercloud.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 11
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Examples of Hybrid Cloud:


• Windows Azure (capable of Hybrid Cloud)
• VMware vCloud (Hybrid Cloud Services)

Cloud Deployment Implications


• Network Dependency – Whether you choose, on-site or off-shore, a reliable and
secure network is highly desirable for good performance.
• Subscribers still need IT skills – You can’t just offer a pink-slip to all your IT
resources. To manage various user devices that access cloud, resources with traditional
IT skills are required, though in lesser number. Additionally, your existing resources
may need to update themselves with new skills for working in cloud.
• Risk from multi-tenancy – On-site private cloud mitigates this security risk by
restricting the number of possible attackers as all the clients are typically the members
of one subscriber organization. In a public cloud scenario, a single machine may be
shared by the workloads of any combination of subscribers. This indeed raises the

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 12
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

security risk as the number of potential attackers increases with number of


subscribers. Therefore we can safely conclude that risk due to multi-tenancy increases
in an order which can be stated as Private, Community, Hybrid, Public cloud.
• Data import/export and performance limitations – Generally the on-demand bulk
data import/export is limited by the cloud’s network capacity. In the on-site
private cloud scenario, however, these limits may be adjusted, although not eliminated,
by provisioning high-performance and/or high-reliability networking within the
subscriber's infrastructure.
• Workloads Locations – Workloads refers to managing hardware resources efficiently.
Generally, cloud migrates workloads between machines without any inconvenience to
the clients, i.e., it’s hidden from the client. Generally, the cloud vendors take care of this
but you must explicitly check with your vendor if it manages the resources efficiently.

Multi-dimensional elements of Cloud Computing

Jericho’s Cloud Cube Model:

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 13
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Cloud Deployment Type and Responsibility

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 14
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Software as a Service (SaaS)


SaaS (Software as a Service) is an application hosted on a remote server and accessed
through the Internet.

SaaS

(Software as a Service) Example :


1. Yahoo, Hotmail, Gmail – Web based Mail
2. CRM Application – MSCRM , SFDC

SaaS Categories:
• Line of business services These are business solutions offered to companies and
enterprises. They are sold via a subscription service. Applications covered under this
category include business processes, like supply-chain management applications, customer
relations applications, and similar business-oriented tools.
• Customer-oriented services These services are offered to the general public on a
subscription basis. More often than not, however, they are offered for free and supported by
advertising. Examples in this category include the aforementioned web mail services, online
gaming, and consumer banking, among others.

SaaS Advantages :
• There’s a faster time to value and improved productivity, when compared to
the long implementation cycles and failure rate of enterprise software.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 15
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• There are lower software licensing costs.


• SaaS offerings feature the biggest cost savings over installed software by
eliminating the need for enterprises to install and maintain hardware, pay
labor costs, and maintain the applications.
• SaaS can be used to avoid the custom development cycles to get applications
to the organization quickly.
• SaaS vendors typically have very meticulous security audits.
• SaaS vendors allow companies to have the most current version of an
application as possible. This allows the organization to spend their
development dollars on new innovation in their industry, rather than
supporting old versions of applications.

SaaS Characteristics:

• The SaaS application needs to be generalized enough so that lots of customers


will be interested in the service.
• SaaS applications need sophisticated navigation and ease of use.
• The SaaS application needs be modular and service oriented.
• An SaaS application needs to include measuring and monitoring so customers
can be charged actual usage.
• An SaaS application must have a built-in billing service.
• SaaS applications need published interfaces and an ecosystem of partners
who can expand the company’s customer base and market reach.
• SaaS applications have to ensure that each customer’s data and specialized
configurations are separate and secure from other customers’ data and
configurations.
• SaaS applications need to provide sophisticated business process
configurators for customers.
• SaaS applications need to constantly provide fast releases of new features and
new capabilities.
• SaaS applications have to protect the integrity of customer data.

Type of SaaS :
01.Packaged software
02.Collaborative software
03.Enabling and Management tools

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 16
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Packaged software:
This is the biggest area of the SaaS market. Packaged software comes in many different
flavors: customer relationship management, supply chain management, financial
management, and human resources, to name the most common. These integrated offers
focus on a specific process, such as managing employees’ benefits, salaries, and annual
performance reviews. These products tend to have several characteristics in common:
They’re designed with specific business processes built in that customers can modify.
They have moved in great numbers to the cloud
Example Packaged software:
• Microsoft with its Dynamics package
• Sales Force with Remedy, Radian, Data.com
• SAP with its By Design offering for the small- to medium-sized business
market
• Oracle with its On Demand offering based on its acquisition of Siebel Software
• Taleo focuses on talent management tasks.
• Concur focuses on employees spend management. It automates costs control
via automated processes.

Collaborative software:
This increasingly vibrant area of the market is driven by the ubiquitous availability of the
Internet, combined with the fact that teams are located all over the world. This area is
dominated by software that focuses on all sorts of collaborative efforts including Web
conferencing, document collaboration, project planning, instant messaging, and even email.
In a sense, it was inevitable that these platforms would move to the cloud: These tasks occur
throughout the organization and need to be easily accessed from many locations.
Example Collaborative software:

• MicrosoftLive has made its first foray into collaboration as a service with its Meeting
Live offering. Today Microsoft offers Meeting Live and live messaging services.
• LotusLive is IBM•fs collaborative environment that includes a set of tools including
social networking, instant messaging, and the ability to share files and conduct online
meetings. IBM is publishing interfaces to allow other collaborative tools to be
integrated into the platform.
• GoogleApps from Google, which has as many as 1.5 million businesses that use its
various collaborative applications including e-mail, document management, and
instant messaging. It publishes APIs so third party software developers can integrate
with the platform.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 17
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• Cisco Webex Collaboration platform comes from Cisco (which bought Webex in 2007)
and it has become the centerpiece of its collaboration SaaS platform. It will probably
use this platform to add unified communications as a service.

Enabling and Management tools:


Development and the deployment of SaaS can be done with development tools that
developers need when creating and extending a SaaS platform; Testing, monitoring, and
measuring that a customer and the developer need.

• Testing as a service
• Monitoring and management as a service
• Development as a service
• Security as a service
• Compliance and governance as a service

SaaS Maturity Model

SaaS Application Architecture

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 18
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

SaaS Authentication system

Centralized authentication system Decentralized authentication system (Single Sign In)

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 19
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Components of Authentication System

01. Directory Services : A directory service is the software system that stores,
organizes and provides access to information in a directory. Active Directory (AD)
is a directory service created by Microsoft for Windows domain networks. Active
Directory provides a central location for network administration and security.
Server computers that run Active Directory are called domain controllers. An AD
domain controller authenticates and authorizes all users and computers in a
Windows domain type network—assigning and enforcing security policies for all
computers and installing or updating software.

02. Federation Services : Active Directory Federation Services (AD FS for short) is a
software component developed by Microsoft that can be installed on Windows
Server operating systems to provide users with Single Sign-On access to systems
and applications located across organizational boundaries. It uses a claims-based
access control authorization model to maintain application security and implement
federated identity.

03. Authentication servers : are servers that provide authentication services to users
or other systems via networking. Remotely placed users and other servers
authenticate to such a server, and receive cryptographic tickets. These tickets are
then exchanged with one another to verify identity.

SaaS Authorization
Typically, access to resources and business functions in a SaaS application is managed by
using roles that map to specific job functions within an organization. Each role is given one or
more permissions that enable users assigned to the role to perform actions in accordance with
any relevant business rules.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 20
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

SaaS Multi-Tenant Data Model

01. Dedicated Tenant Database : The first approach involves simply giving each
tenant its own database, which the tenant can extend as necessary.

02. Shared Database, Fixed Extension Set : The second approach involves building
a single database that is shared by all of your tenants, and that includes a preset
number of custom fields that tenants can assign and use as desired

03. Shared Database, Custom Extensions : The third approach involves building a
single, shared database, and allowing customers to extend the data model arbitrarily,
storing custom data as name–value pairs in a separate table

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 21
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Platform as a Service (PaaS)


Platform as a service (PaaS) is a category of cloud computing services that provide a
computing platform and a solution stack as a service. In the classic layered model of cloud
computing, the PaaS layer lies between the SaaS and the IaaS layers.
PaaS services include application design, development, testing, deployment, and
hosting. Other services include team collaboration, web service integration, databa se
integration, security, scal ability, storage, state management, and versioning.
Example of PaaS :
01. Microsoft Azure
02. Force.com from Sales Force
03. AWS from Amazon

PaaS Categories
01.Integrated lifecycle platform
02.Anchored lifecycle platform
03.Enabling technologies as a platform

Integrated lifecycle platforms : Several emerging key platforms provide the


developer with a full environment for creating an application without buying any individual
tools. For example, the platform provider will provide the developer with a full stack
including an operating system, a programming language, security, storage, version control,
collaborative tools, as well as tools to build Web interaction.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 22
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

These integrated PaaS often include the following:

✓ A workflow engine
✓ Development tools
✓ A testing environment
✓ An ability to integrate databases
✓ Third-party tools and services

Eg : 01. Microsoft’s Azure


02. Google Aps

Anchored lifecycle platforms: Anchored platforms have most of the same


characteristics as the integrated lifecycle platform, there is one key difference: These
environments have a packaged business software at the core.

Characteristics :
✓ A large customer base
✓ Defined services such as billing
✓ Security and authentication
✓ Programming languages
✓ Integration services

Eg : 01. Salesforce.com its Force.com platform


02. MSCRM Dynamic CRM
03. QuickBooks financial software environment

Enabling technologies as a platform : Not all platforms in the cloud include a full
lifecycle environment. Some platforms are focused on providing specialized capabilities.
Some of these capabilities may be a specific tool.

Eg : AWS

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 23
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

PaaS Options :
01.Add-on development facilities These allow existing SaaS applications to be
customized. Often, PaaS developers and users are required to purchase subscriptions
to the add-on SaaS application.
02.Stand-alone environments These environments do not include licensing, technical,
or financial dependencies on specific SaaS applications and are used foR general
developments.
03.Application delivery-only environments These environments support hostinglevel
services, like security and on-demand scalability. They do not include development,
debugging, and test capabilities.

PaaS Characteristics:
• Services to develop, test, deploy, host and maintain applications in the
same integrated development environment
• Web based user interface creation tools.
• Multi-tenant architecture.
• Integration with web services and databases.
• Support for development team collaboration.
• Utility-grade instrumentation
• Built-in Scalability, Reliability, and Security
• Deep Application Instrumentation

Benefits of PaaS

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 24
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

PaaS Offerings :
Compute Clouds:
Compute clouds allow access to highly scalable, inexpensive, on-demand computing
resources that run the code that they’re given.

Three examples of compute clouds are :


• Amazon’s EC2
• Google App Engine
• Berkeley Open Infrastructure for Network Computing (BOINC)

Cloud Storage :
One of the first cloud offerings was cloud storage and it remains a popular solution. Cloud
storage is a big world. There are already in excess of 100 vendors offering cloud storage.
This is an ideal solution if you want to maintain files off-site.

Cloud Applications :
Cloud applications differ from compute clouds in that they utilize software applications that
rely on cloud infrastructure. Cloud applications are versions of Software as a Service (SaaS)
and include such things as web applications that are delivered to users via a browser or

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 25
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

application like Microsoft Online Services. These applications offload hosting and IT
management to the cloud.

Cloud applications often eliminate the need to install and run the application on the
customer’s own computer, thus alleviating the burden of software maintenance, ongoing
operation, and support.

Some cloud applications include


• Peer-to-peer computing (like BitTorrent and Skype)
• Web applications (like MySpace or YouTube)
• SaaS (like Google Apps)
• Software plus services (like Microsoft Online Services)
PaaS Services in Sales Force

PaaS Services in MS Azure

PaaS Services in Open Nebula

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 26
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

PaaS Services in Amazon EC2

PaaS Services in BMC Cloud


Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 27
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

PaaS Services in IBM Smart Cloud

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 28
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 29
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Infrastructure as Service (IaaS)


Infrastructure as a Service is a provision model in which an organization outsources the
equipment used to support operations, including storage, hardware, servers and networking
components. The service provider owns the equipment and is responsible for housing,
running and maintaining it. The client typically pays on a per-use basis.
Infrastructure as a Service is sometimes referred to as Hardware as a Service (HaaS)

Example of IaaS :
• Server space
• Network equipment
• Memory
• CPU cycles
• Storage space

Characteristics of IaaS
• Utility computing service and billing model
• Automation of administrative tasks.
• Dynamic scaling.
• Desktop virtualization.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 30
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• Policy-based services.
• Internet connectivity.

Types of IaaS
• Enterprise-Class Cloud Offerings
• Client–Class Cloud Offerings
Enterprise-Class Cloud Offerings: it’s a behind-the-firewalls use of commercial, Internet-
based cloud technologies specifically focused on one company’s or one business
environment’s computing needs
Eg :
01.Server Storage Space
02.Processing
03.MS Exchange
04.Vmotion
05.Hyper-V Live Migration

Client–Class Cloud Offerings : Offering of HW service to client as service is known as


Client – class cloud offerings.
Eg : 01. HW hosting Email or Website
02. Offering services to thin client.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 31
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Data Management in Cloud


Database Management & Components
A database management system (DBMS) is a software package with computer programs that
control the creation, maintenance, and the use of a database. It allows organizations to
conveniently develop databases for various applications
DBMS engine accepts logical requests from various other DBMS subsystems, converts them
into physical equivalents, and actually accesses the database and data dictionary as they exist
on a storage device.
• Data definition subsystem helps the user create and maintain the data dictionary
and define the structure of the files in a database.
• Data manipulation subsystem helps the user to add, change, and delete information
in a database and query it for valuable information. Software tools within the data
manipulation subsystem are most often the primary interface between user and the
information contained in a database. It allows the user to specify its logical information
requirements.
• Application generation subsystem contains facilities to help users develop
transaction-intensive applications. It usually requires that the user perform a detailed
series of tasks to process a transaction. It facilitates easy-to-use data entry screens,
programming languages, and interfaces.
• Data administration subsystem helps users manage the overall database
environment by providing facilities for backup and recovery, security management,
query optimization, concurrency control, and change management.

Database Backups :
Most database engines provide multiple mechanisms for executing database backups. The
rationale behind having different backup strategies is to provide a trade-off between the
impact that executing a backup has on the production environment and the integrity of the
data in the backup.
• Database export/dump backup
• Filesystem backup
• Transaction log backup

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 32
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Data Security:
01. Encryption
• Encrypt your network traffic
• Encrypt your backups
• Encrypt your filesystems
02.Regulatory and Standards Compliance
03.Network Security
04.Firewall Rules
05.Network Intrusion Detection
Perimeter security often involves network intrusion detection systems (NIDS),
such as Snort, which monitor local traffic for anything that looks irregular.
Examples:
o Port scans
o Denial-of-service attacks
o Known vulnerability exploit attempts

06.Host Security
Host security describes how your server is set up for the following tasks:
o Preventing attacks.
o Minimizing the impact of a successful attack on the overall system.
o Responding to attacks when they occur.
07.System Hardening
08.Antivirus Protection
09.Data Segmentation
10.Credential Management
11.Compromise Response

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 33
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Data Security Life Cycle

Disaster Recovery
Disaster recovery is the process, policies and procedures related to preparing for recovery
or continuation of technology infrastructure critical to an organization after a natural or
human-induced disaster. Disaster recovery is a subset of business continuity. While
business continuity involves planning for keeping all aspects of a business functioning in
the midst of disruptive events, disaster recovery focuses on the IT or technology systems
that support business functions.
• Preventive measures - These controls are aimed at preventing an event from
occurring.
• Detective measures - These controls are aimed at detecting or discovering unwanted
events.
• Corrective measures - These controls are aimed at correcting or restoring the system
after disaster or event.
Disaster Recovery Planning
Disaster recovery deals with catastrophic failures that are extremely unlikely to occur
during the lifetime of a system. If they are reasonably expected failures, they fall under the
auspices of traditional availability planning
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 34
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Disaster recovery plan involves two key metrics :

Recovery Point Objective (RPO)


The recovery point objective identifies how much data you are willing to lose in the event
of a disaster. This value is typically specified in a number of hours or days of data. For
example, if you determine that it is OK to lose 24 hours of data, you must make sure that
the backups you’ll use for your disaster recovery plan are never more than 24 hours old
Recovery Time Objective (RTO)
The recovery time objective identifies how much downtime is acceptable in the event of a
disaster. If your RTO is 24 hours, you are saying that up to 24 hours may elapse between
the point when your system first goes offline and the point at which you are fully
operational again.

Disasters Recovery in the Cloud


1. Backups and data retention
2. Geographic redundancy
3. Organizational redundancy

01. Disasters Management - Backups and data retention


A) Backup Management : The ability to recover from a disaster by the quality and frequency
of your backups In a traditional IT infrastructure is called Backup Management.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 35
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

B) Fixed data strategy : When a application data remains same as base is called Fixed Data
Strategy
C) Configuration data strategy : A good backup strategy for configuration information
comprises two levels. The first level can be either a regular file system dump to your cloud
storage or a file system snapshot. For most applications, you can back up your configuration
data once a day or even once a week and be fine. You should, however, think back to your
Recovery Point Objective. If your configuration data changes twice a day and you have a two-
hour RPO
D) Transient data : Data that is created within an application session. At the end of the
session, it is discarded or reset back to its default and not stored in a database.
E) Persistent data strategy (aka database backups): Recommended using a relational
database to store customer information and other persistent data. The purpose of a relational
database is to maintain the consistency of complex transactional data.

02. Disasters Management - Geographic Redundancy : The geographic


redundancy service replicates data between two geographically distant sites so that
applications can switch from one site to another (for example, in case of the catastrophic
failure of one) and still have all the configuration data (account information, system SLAs,
and budgets) necessary for SLA enforcement available at the second, remote.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 36
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Disasters Management - Geographic Redundancy – Configuration Process

Configuration Workflow

There are two stages to configuring basic geographic redundancy. Both must be done at
each site.
• Configure the geographically redundant service.
• Define the geomaster site

Configure Each Site for Geo-Redundancy


To use geographic redundancy, each site must be appropriately configured. This is
accomplished using the GeoRedundantService. Using this service, you:

• Define the ID of the local site in Attribute: GeoSiteId.


• Define the number of failed attempts to reach a remote site before an alarm should
be raised in Attribute: RemoteSiteReachabilityAlarmThreshold.
• Define the remote site in Operation: setSiteAddress.

Define the GeoMaster Site


One site of the site pair must be designated the geomaster site. This is accomplished using
the GeoStorageService. Using this service, you:
• Define the site that is to serve as the geomaster in Attribute: GeoMasterSiteId

3. Disasters Management - Organizational Redundancy


Organizational Redundancy occurs in database systems which have a field that is repeated in
two or more tables. For instance, in case when customer data is duplicated and attached with
each product bought then redundancy of data is a known source of inconsistency.
This happens on cloud due to multiple organization running on same server without
segregating the common platform data.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 37
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Scaling a Cloud
Cloud Scale
The cloud empowers computing resources to meet your load requirements. You can alter
your capacity both manually (by executing a command on a command line or through a web
interface) and programmatically (through predefined changes in capacity or through
software that automatically adjusts capacity to meet actual demand).
01. Dynamic scaling
This term—which I sometimes also refer to as cloud scaling—enables software to adjust the
resources in your infrastructure without your interactive involvement. Dynamic scaling can
take the form of proactive scaling or reactive scaling.
02. Proactive scaling
This involves a schedule for altering your infrastructure based on projected demand.we
would configure our cloud management tools to run with a minimal infrastructure that
supports our availability requirements during the early morning hours, add capacity in the
late morning, drop back to the baseline until lunch, and so on. This strategy does not wait for
demand to increase, but instead increases capacity based on a plan.
03. Reactive scaling
In this strategy, your infrastructure reacts to changes in demand by adding and removing
capacity on its own accord. In the capacity valuation thought experiment, an environment
engaging in reactive scaling might have automatically added capacity when it detected the
unexpected spike in activity on the CMO blog.

Scaling Measure
Scalability can be measured in various dimensions, such as:
Administrative scalability: The ability for an increasing number of organizations to easily
share a single distributed system.
Functional scalability: The ability to enhance the system by adding new functionality at
minimal effort.
Geographic scalability: The ability to maintain performance, usefulness, or usability
regardless of expansion from concentration in a local area to a more distributed geographic
pattern.
Load scalability: The ability for a distributed system to easily expand and contract its
resource pool to accommodate heavier or lighter loads. Alternatively, the ease with which a
system or component can be modified, added, or removed, to accommodate changing load.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 38
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Scale horizontally (scale out) : To scale horizontally (or scale out) means to add more
nodes to a system, such as adding a new computer to a distributed software application. An
example might be scaling out from one Web server system to three.

Scale vertically (scale up): To scale vertically (or scale up) means to add resources to a
single node in a system, typically involving the addition of CPUs or memory to a single
computer. Such vertical scaling of existing systems also enables them to use virtualization
technology more effectively, as it provides more resources for the hosted set of operating
system and application modules to share.
Taking advantage of such resources can also be called "scaling up", such as expanding the
number of Apache daemon processes currently running.

Tradeoffs
There are tradeoffs between the two models. Larger numbers of computers means increased
management complexity, as well as a more complex programming model and issues such as
throughput and latency between nodes; also, some applications do not lend themselves to a
distributed computing model. In the past, the price difference between the two models has
favored "scale out" computing for those applications that fit its paradigm, but recent
advances in virtualization technology have blurred that advantage, since deploying a new
virtual system over a hypervisor (where possible) is almost always less expensive than
actually buying and installing a real one. Configuring an existing idle system has always been
less expensive than buying, installing a configuring a new one, regardless of the model.

Complete Cloud Logical Diagram :

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 39
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 40
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Module 2
Sales Force
Consulting
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 41
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Introduction to CRM
Customer relationship management (CRM) is a widely implemented model for managing a
company’s interactions with customers, clients, and sales prospects. It involves using
technology to organize, automate, and synchronize business processes—principally sales
activities, but also those for marketing, customer service, and technical support.

Mid-1980s : Personal Information Managers (PIM) and Contact Management Systems. Both
PIM and CMS systems enabled you to organize the names, addresses, and phone numbers
for all your business contacts
Late 1980s: PIMs were superseded by Sales Force Automation (SFA) systems. Products
such as ACT and GoldMine initially combined scheduling functions with contact
management
Mid-1990s: Customer Relationship Management (CRM) systems, attempting to involve not
just sales people but also customer service and management.

Goals of CRM Systems:


➢ Personalization
➢ Knowing customers
➢ Identifying most profitable customers
➢ Creating unbreakable customer loyalty
➢ Customer self-service
➢ Integrated analytics
➢ Content management

Implementing CRM Successfully (CRM life Cycle)


❖ Define
❖ Measure
❖ Analyze
❖ Control
❖ Customize
❖ Implement
❖ Feedback

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 42
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Introduction to SFDC
Salesforce.com is an enterprise cloud computing company headquartered in San Francisco
that distributes business software on a subscription basis. Salesforce.com hosts the
applications off-site. It is best known for its Customer Relationship Management (CRM)
products.
Salesforce.com was founded in March 1999 by former Oracle executive Marc Benioff, Parker
Harris, Dave Moellenhoff, and Frank Dominguez as a company specializing in software as a
service (SaaS).[6] Harris, Moellenhoff and Dominguez, three software developers previously
at Clarify, wrote the initial sales automation software.

SFDC Packages :

Service Cloud
Sales Cloud Data.com Remedyforce Radian6 SFDC Flavors:
✓ Personal: Basic account, contact, and
opportunity management for one person. Salesforce doesn’t promote this edition anymore,
but it still exists after you let your free trial run out.
✓ Contact Manager: Basic account and contact management for up to five users. No lead or
opportunity tracking.
✓ Group: Basic CRM, which includes the ability to view dashboards, and track leads and
opportunities, for teams of up to five users. This allows you to view the full sales lifecycle,
from the initial interaction with a lead, to a closed opportunity.
✓ Professional: Thorough CRM for any size organization that’s starting to nail down
processes. Again, you can track the full sales lifecycle from a new lead to a close opportunity.
Some optional features for businesses with more detailed process needs (such as managing
marketing campaigns, creating contracts, tracking various products sold, or accessing
Salesforce while offline) come at an extra cost.
✓ Enterprise: More sales and service functionality for more complex organizations. This
edition provides more value than if you were to pay extra for certain add-on features in more
basic editions.
✓ Unlimited: A lot more customization capabilities for extending Salesforce to other
business uses. You need a dedicated (and usually technical) administrator to take advantage
of all the options that this edition delivers.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 43
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

SFDC Platform Architecture

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 44
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Sales Force Basic Components and Navigation

SFDC Account Creation : Create account in SFDC Developer Force


http://developer.force.com/
Home page: This is the main page that appears when you log in to Salesforce or click the
Home tab.
Tabs: Clickable links appear at the top of any Salesforce page. When selected, a link is
highlighted and looks like a tab, and so we continue to call them tabs. Each tab represents a
major module in which your company needs to know some information. By clicking a tab,
you go to a tab-specific home page. For example, if you click the Accounts tab, the Accounts
home page appears.
Apps: Apps are tabs that have been grouped together and given a name, providing you with
the convenience of seeing only those tabs most relevant to you.
Tab home pages: This is the page where you go to find, organize, and manage specific
information related to a particular tab. For example, to access your opportunity records,
you could go to the Opportunities home page.
Record: This is made up of a bunch of fields that hold information to describe a specific
item. For example, a contact record typically contains fields pertinent to a person, including
name, title, phone number, and e-mail address. A record is displayed on a detail page.
Detail page: This Web page shows both the saved record and a set of related lists pertinent
to the record.
Sales Force Objects/Entities
01. Accounts : Accounts are your organization's customers, competitors, and partners.
Each account stores information such as name, address, and phone numbers. For each
account, you can store related information such as opportunities, activities, cases, partners,
contracts, and notes.
Mode of Accounts :
✓ Edit: You can modify fields.
✓ Saved: You can view the fields and the account’s related lists, which are located below
the record fields.

Types Of Account :

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 45
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

1. Person Account : A person account is an individual consumer with whom you


do business, such as a financial services client, an online shopper, or a vacation
traveler. Person accounts are applicable to organizations that operate on a
business-to-consumer model as opposed to a business-to-business model.
2. Business Account : Business being primary contact

02. Contacts : Contacts are the people associated with your business accounts that you
need to track in Salesforce. For each contact, you can store various kinds of information,
such as phone numbers, addresses, titles, and roles in a deal.

03. Campaign: A campaign is an outbound marketing project that you want to plan,
manage, and track within Salesforce. It can be a direct mail program, seminar, print
advertisement, email, or other type of marketing initiative.
A) Campaign Status: Planned , In progress, Completed, Aborted
B)Campaign Type : Conference, webinar , Trade Show, Public Relation, Partners,
Advertisements, Banner, Email, Mail, Telemarketing
Campaign Life cycle :
1. Create the campaign

After determining your marketing strategy, create a campaign to track your efforts. Create your
target list

o Rented or Purchased Lists - Simply use the list of names as your target list.
o Existing Contacts, Leads, or Person Account – Adding Existing customer from Account and
contacts
2. Execute the campaign

All campaign execution occurs outside of Salesforce. It can be online or offline, for example:

o Online - Send email using an email execution vendor.


o Offline - Plan and host a conference; run print or radio advertisements; send direct mail
pieces; or host a Web seminar.
3. Track responses
o Website Response - Prospects respond by filling in a form on your website. Use Web-to-Lead
to set up a jump page or microsite for the campaign. All responses are created as leads,
o Manual Update - Customers and prospects respond via phone or mail. A sales or marketing
team member can manually update the Campaign History for the lead, contact, or person
account.
o Mass Update/Offline Response - The third type of response is any response that you track
in an offline list, for example, trade show attendance or email responses from your email
vendor.
4. Analyze campaign effectiveness

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 46
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

The final step is to analyze the effectiveness of the campaign using reports and campaign statistics.
for information on calculating statistics.

04. Lead : A lead is a prospect or potential opportunity


Lead Stages (7) :
01.Lead generation – Advertising
02.Lead - Advertising respond, creating a Customer inquiry
03.Inquiry Capture/Inquiry filtering
04.Lead grading - Prioritized for potential
05.Lead distribution - Leads are then distributed to marketing and/or sales personnel
06.Lead contact - Leads are contacted for prospecting
07.Lead nurturing - Contacted and uncontacted leads are entered into personal and
automated follow-up processes
Leads Conversion :
Opportunity

Account
Lead
05. Opportunity: Any prospect deal where requirement exist is called as opportunity
Opportunity Stages (Sales Pipeline) : A sales pipeline is a systematic approach to selling a
Contact
product or service.
01.Prospecting
02.Qualification
03.Need Analysis
04.Value Proposition
05.Id. Decision Makers
06.Perception Analysis
07.Proposal/Price Quote
08.Negotiation/Review
09.Closed Won
10.Closed Lost

06. Product/Quote/Order/Invoice:
Product : Products are the individual items that you sell on your opportunities and
quotes

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 47
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Price Book(Price List): A price book contains products and their associated prices.
Each product with its associated price is referred to as a price book entry.
Quote : A proposed offer for products or services for an existing customer. The Quote
can include specific payment, a discount, and delivery terms.

Quote Life Cycle :

Order: An accepted Quote.


Order Life Cycle :

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 48
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Invoice : When the terms of the sale have been completed, the sale is recorded using an
Invoice.

07. Case/Contracts/Solutions :
Case: Registering and problems or issues in CRM is called case.
Contracts : Any agreement on service is termed as contracts .

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 49
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Solution : A solution is a detailed description of a customer issue and the resolution


of that issue.

08. Answers/Ideas/Chatter:
Answers : Answers is a feature of the Community application that enables users to
ask questions and have community members post replies. Community members can then
vote on the helpfulness of each reply, and the person who asked the question can mark one
reply as the best answer.
Ideas: Ideas is a community of users who post, vote for, and comment on ideas.
Consider it an online suggestion box that includes discussions and popularity rankings for
any subject.
Chatter: Chatter is a Salesforce collaboration application that helps you connect with
people and share business information securely and in real time.

09. Documents/Files: A document library is a place to store files without attaching


them to accounts, contacts, opportunities, or other records. Each document in the document
library resides in a folder. The folder’s attributes determine the accessibility of the folder and
the documents within it.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 50
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Module -3
Sales force
Administration
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 51
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Users
Navigation : Setup > Administration Setup > Manage Users > Manage Users>

Creating Users : Create, edit, and deactivate user


Navigation: Setup > Administration Setup > Manage Users > Manage Users>> New User

Mass Email Users : Send an email to several of your users at once.


Navigation: Setup > Administration Setup > Manage Users > Manage Users>> Mass Email Users

Roles: Define your organization’s role hierarchy. Navigation: >Roles


Roles limitation:
01. In show in list view columns are not sortable
02. In show in list view Max List is 1,000 roles.
03. You can create up to 500 roles.

Permission Sets : A permission set is a collection of settings and permissions that give users
access to various tools and functions. Specify user permissions, object permissions, field
permissions, and access to apps, tabs, Apex classes, Visualforce pages, and service providers,
without changing users' profiles.
Navigation: Setup > Administration Setup > Manage Users > Manage Users> >Permission Sets

Profiles : A profile contains user permissions and access settings that control what users can
do within their organization. Specify user permissions, object permissions, field permissions,
record types, page layouts, desktop clients, login settings, and access to apps, tabs, Apex
classes, Visualforce pages, and service providers.
Navigation: Setup > Administration Setup > Manage Users > Manage Users> > Profiles

Standard Profiles :

Profile Name Available Permissions


Can configure and customize the application. Has access to all functionality that does not
System require an additional license. For example, administrators cannot manage campaigns unless
Administrator they also have a Marketing User license. Can manage price books and products. Can edit any
quota, override forecasts, and view any forecast.
Standard Platform Can use custom Force.com AppExchange apps developed in your organization or installed from
User AppExchange. In addition, can use core platform functionality such as accounts, contacts,

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 52
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Profile Name Available Permissions


reports, dashboards, and custom tabs. For more information on Salesforce Platform user
licenses
Can use one custom AppExchange app developed in your organization or installed from
Standard Platform
AppExchange. The custom app is limited to five tabs. In addition, can use core platform
One App User
functionality such as accounts, contacts, reports, dashboards, and custom tabs.
Can create and edit most major types of records, run reports, and view the organization's setup.
Standard User Can view, but not manage, campaigns. Can create, but not review, solutions. Can edit personal
quota and override forecasts.
Partner User Can only log in via a partner portal.
Can only log in via a Customer Portal. For more information
Can only log in via a Customer Portal. Can view and edit data they directly own or data owned
Customer Portal
by or shared with users below them in the Customer Portal role hierarchy; and they can view
User
and edit cases where they are listed in the Contact Name field.
Can only log in via a Customer Portal. Can view and edit data they directly own or data owned
Customer Portal
by or shared with users below them in the Customer Portal role hierarchy; and they can view
Manager
and edit cases where they are listed in the Contact Name field.
Can review and publish solutions. Also has access to the same functionality as the Standard
Solution Manager
User.
Can manage campaigns, import leads, create letterheads, create HTML email templates, manage
Marketing User public documents, and update campaign history via the import wizards. Also has access to the
same functionality as the Standard User.
Can create, edit, activate, and approve contracts. This profile can also delete contracts as long as
Contract Manager
they are not activated. Can edit personal quota and override forecasts.
Read Only Can view the organization's setup, run and export reports, and view, but not edit, other records.
Can only log in to Chatter. Can access all standard Chatter people, profiles, groups, and files.
Additionally, they can:

Chatter Only User • View Salesforce accounts and contacts


• Use Salesforce CRM Content, Ideas, and Answers
• Modify up to ten custom objects

Chatter Free User Can only log in to Chatter. Can access all standard Chatter people, profiles, groups, and files.
Chatter External Can only log into Chatter and access groups they've been invited to and interact with members
User of those groups. Only available with the Chatter External user license.
Can only log in to Chatter. Can access all standard Chatter people, profiles, groups, and files.
Additionally, this user can:
Chatter Moderator
• Activate and deactivate other Chatter Free users and moderators
User
• Grant and revoke moderator privileges
• Delete posts and comments that they can see

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 53
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Profile Name Available Permissions


Can only log in to the Site.com app. Each Site.com Only user also needs a Site.com Publisher
feature license to create and publish sites, or a Site.com Contributor feature license to edit the
site's content.
Additionally, this user can:
Site.com Only User
• Use one custom app with up to 20 custom objects
• Access the Content app, but not the Accounts and Contacts objects
• Create unlimited custom tabs

Public Groups : 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.
Navigation: Setup > Administration Setup > Manage Users > Manage Users> > Public Groups

Two types of groups:


• Public groups—Only administrators can create public groups. They can be used by everyone in the
organization.
• Personal groups—Each user can create groups for their personal use.

Queues : Add, update, or delete queues for cases, leads, and custom objects.
Navigation: Setup > Administration Setup > Manage Users > Manage Users>Queues

Login History : View when your users are logging in. Administrators can monitor the
successful and failed login attempts for their organization and enabled portals. The columns
on this page provide information about each login attempt. The login history page displays
the most recent 20,000 entries in the login history database. If you need to see more records,
you can download the information to a CSV or GZIP file.
Navigation: Setup > Administration Setup > Manage Users > Manage Users> Login History

Company Profile
Setup > Administration Setup > Company Profile

Company Information: Update your company's information and set up multiple


currencies.
Navigation : Setup > Administration Setup > Company Profile > Company Information.

Manage Currencies: Set up multiple currencies.


Navigation : Setup > Administration Setup > Company Profile > Manage Currencies

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 54
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Manage Divisions: Divisions let you segment your organization's data into logical sections,
making searches, reports, and list views more meaningful to users. Set up divisions to
segment your data for greater ease-of-use.Fiscal Year: Set up fiscal years for your
organization.
Navigation : Setup > Administration Setup > Company Profile > Manage Divisions

Business Hours: Set up business hours for your customer support team.
Navigation : Setup > Administration Setup > Company Profile > Business Hours

Holidays: Set up holidays during which business hours for your customer support team
don't apply.
Navigation : Setup > Administration Setup > Company Profile > Holidays

My Domain: Set up a custom Salesforce domain name, which appears in the URLs that you
use to login to and use the application.
Navigation : Setup > Administration Setup > Company Profile > My Domain

Security Controls
Setup > Administration Setup >Security Controls
Types Of Security :

01. Object Level Security :


a) Sharing Objects/OWD
b) Field Level Security.

02. Role Level Security :


a) Profiles
b) Organizational Hierarchy

OWD Access Levels

• Public Read/Write/Transfer (only available of Leads and Cases)


• Public Read/Write
• Public Read/Only
• Private

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 55
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Limitations:

• Solutions are always Public Read/Write.


• Service contracts are always Private.

Sharing Settings: Define how your users share data.


Navigation : Setup > Administration Setup >Security Controls > Sharing Settings

Field Accessibility: View the access that users have to specific fields based on profile and
record types.
Navigation : Setup > Administration Setup >Security Controls > Field Accessibility

Field Accessibility Components :


• Page layouts—You can set whether fields are visible, required, editable, or read only.
• Field-level security—You can further restrict users' access to fields by setting whether those fields
are visible, editable, or read only. These settings override any field properties set in the page layout
if the field-level security setting is more restrictive.
• Permissions—Some user permissions override both page layouts and field-level security settings.
For example, users with the “Edit Read Only Fields” permission can always edit read-only fields
regardless of any other settings.
• Universally required fields—A custom field can be made universally required, which overrides any
less-restrictive settings on page layouts or field-level security.

Password Policies : Define password policies for security.


Navigation : Setup > Administration Setup >Security Controls > Password Policies

- User passwords expire in 90 Days


- Enforce password history The default is 3 passwords remembered
- Minimum password length. The default is 8 characters
- Password complexity requirement
- Password question requirement
- Maximum invalid login attempts
- Lockout effective period. The default is 15 minutes

Session Settings: Lock users’ sessions to an IP address or change session timeout settings.
Navigation : Setup > Administration Setup >Security Controls > Session Settings

Network Access: Define IP addresses from which users can log in to your organization.
Navigation : Setup > Administration Setup >Security Controls > Network Access
- The start and end IP addresses in an IPv4 range must include no more than 33,554,432 addresses

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 56
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

- 0.0.0.0 to 1.255.255.255 (Correct)


- 132.0.0.0 to 132.255.255.255(Correct)
- 132.0.0.0 to 133.255.255.255(Correct)
- 0.0.0.0 to 2.255.255.255 or 132.0.0.0 to 134.0.0.0 (incorrect)

Certificate and Key Management :Create and manage Salesforce key pairs and certificates
for your organization.
Navigation : Setup > Administration Setup >Security Controls > Certificate and Key Management

Management :

• Manage your certificates


• Manage your master encryption key

Types of certificates

- Self-signed : A self-signed certificate is signed by Salesforce. Not all external websites accept self-
signed certificates.
- CA-signed : A CA-signed certificate is signed by an external certificate authority (CA). Most
external websites accept CA-signed certificates. You must first generate the certificate signing
request to send to a CA, and then import the signed version of the certificate before you can use it.

View Setup Audit Trail: The setup audit trail history helps you track the recent setup changes that you
and other administrators have made to your organization. This can be especially useful in organizations with
multiple administrators. View which users have recently changed your organization’s setup.
Navigation : Setup > Administration Setup >Security Controls > View Setup Audit Trail

Account Owner Report : Restrict users from running the Account Owners report, which lists
all accounts and who owns them.
Navigation : Setup > Administration Setup >Security Controls > Account Owner Report

Expire All Passwords: Expire passwords for all users in the organization.
Navigation : Setup > Administration Setup >Security Controls > Expire All Passwords

Delegated Administration: Enable standard users to perform some administrative duties.


Navigation : Setup > Administration Setup >Security Controls > Delegated Administration

Remote Site Settings : Specify the Web addresses that your organization can invoke from
Salesforce. You must specify a site before callouts to them from Visualforce pages, Apex, or
the AJAX proxy will function correctly.
Navigation : Setup > Administration Setup >Security Controls > Remote Site Settings

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 57
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

HTML Documents and Attachments Settings :Restrict users from uploading HTML files
as attachments or to the Documents tab.
Navigation : Setup > Administration Setup >Security Controls > HTML Documents and Attachments Settings

Communication Templates
Letterheads : A letterhead defines the logo, page color, and text settings for your HTML email
templates. For best results, create a single letterhead to use for all your HTML email
templates. You can create letterheads and make them available organization-wide. Create
branded letterheads for HTML emails.
Navigation : Setup > Administration Setup > Communication Templates > Letterheads

Email Templates : Create email templates to standardize communication.


Navigation : Setup > Administration Setup > Communication Templates> Email Templates

Types:
- Text - All users can create or change text email templates.
- HTML with letterhead - Administrators and users with the “Edit HTML Templates” permission can
create HTML email templates based on a letterhead.
- Custom HTML - Administrators and users with the “Edit HTML Templates” permission can create
custom HTML email templates without using a letterhead. You must either know HTML or obtain the
HTML code to insert in your email template.
- Visualforce - Administrators and developers can create templates using Visualforce. Visualforce
email templates allow for advanced merging with a recipient's data, where the content of a template
can contain information from multiple records.

Mail Merge Templates : Mail merge templates define the content of a form letter or other
mail merge document. They include variables called merge fields where data from your
records—for example a contact's name and address—displays in the generated document.
Navigation : Setup > Administration Setup > Communication Templates> Mail Merge Templates

Translation Bench
Setup > Administration Setup> Translation Bench
Translation Setting
Translate
Import
Export

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 58
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Data Management
Setup > Administration Setup >Data Management

Analytic Snapshots: Enable users to automatically run reports and save report results to
fields on custom objects for further customization.
Navigation : Setup > Administration Setup >Data Management > Analytic Snapshots

Import Accounts/Contacts, Import Person Accounts, Import Leads, Import Solutions,


and Import Custom Objects : Import your organization’s accounts, contacts, custom
objects, leads, person accounts, and solutions.
Navigation : Setup > Administration Setup >Data Management

Data Export: Export your organization’s data.


Navigation : Setup > Administration Setup >Data Management > Data Export

Storage Usage: View how much data storage and file storage your organization is using.
Navigation : Setup > Administration Setup >Data Management > Storage Usage

Mass Transfer Records :Transfer multiple records at one time.


Navigation : Setup > Administration Setup >Data Management > Mass Transfer Records

Mass Delete Records : Delete multiple records at one time.


Navigation : Setup > Administration Setup >Data Management > Mass Delete Records

Limitation and Factors:

- You can only delete up to 250 items at one time.


- When you delete a record, any associated records that display on that record's related lists are also
deleted.
- Accounts and contacts associated with cases cannot be deleted.
- Partner accounts with partner users cannot be deleted.
- Contacts enabled for Self-Service, and their associated accounts, cannot be deleted.
- When deleting products, all related price book entries are deleted with it.
- Products on opportunities cannot be deleted, but they can be archived.
- When you delete activities:
o Any archived activities that meet the conditions are also deleted.
o Requested meetings aren't included in the mass-delete until they're confirmed and
automatically converted to events.
- The child events of a recurring event are not displayed in the list of possible items to delete, but they
are deleted along with their associated event series.
- Deleting a master solution does not delete the translated solutions associated with it. Instead, each
translated solution becomes a master solution.
- Deleting a translated solution removes the association with its master solution.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 59
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Mass Transfer : Transfer multiple Records, approval requests at one time.


Navigation : Setup > Administration Setup >Data Management > Mass Transfer

Mass Update Addresses : Update the Country or State/Province field on all records with an
address. These include addresses in accounts, contacts, contracts, invoices, leads, and orders.
Navigation : Setup > Administration Setup >Data Management> Mass Update Addresses

Data Loader : Download a client application that allows you to import, update, delete, and
export large quantities of records.
Navigation : Setup > Administration Setup >Data Management > Data Loader

Data Loader features:


- An easy-to-use wizard interface for interactive use
- An alternate command line interface for automated batch operations
- Support for large files with up to 5 million records
- Drag-and-drop field mapping
- Support for all objects, including custom objects
- Can be used to process data in both Salesforce and Database.com
- Detailed success and error log files in CSV format
- A built-in CSV file viewer
- Support for Windows 7
-
When To Use

➢ You need to load 50,000 to 5,000,000 records. Data Loader is supported for loads of up to 5 million
records. If you need to load more than 5 million records, we recommend you work with a
salesforce.com partner or visit the App Exchange for a suitable partner product.
➢ You need to load into an object that is not yet supported by the import wizards.
➢ You want to schedule regular data loads, such as nightly imports.
➢ You want to export your data for backup purposes.

Data Loader Usage:

- User interface—When you use the user interface, you work interactively to specify
the configuration parameters, CSV files used for import and export, and the field
mappings that map the field names in your import file with the field names in
Salesforce.
- Command line—When you use the command line, you specify the configuration, data
sources, mappings, and actions in files. This enables you to set up Data Loader for
automated processing.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 60
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Reports & Dashboards: A report returns a set of records that meets certain criteria,
and displays it in organized rows and columns. Report data can be filtered, grouped, and
displayed graphically as a chart. Reports are stored in folders

Report
Type Description
This is the most basic report. It displays just the row of records in a table like format
Tabular with grand total. Tabular reports cannot be used for generating dashboards.
This is the most commonly type of report. It allows grouping of rows of data. It supports
sorting and displaying subtotals. For example in a recruiting app, a summary report
Summary could be used to display open positions classified by department name.
This is the most complex report format. Matrix report summarizes information in a grid
Matrix format. Matrix reports allow records to be grouped by both columns and rows.
Joined reports let you create multiple report blocks that provide different views of your
data. Each block acts like a “sub-report,” with its own fields, columns, sorting, and
Joined filtering. A joined report can even contain data from different report types

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 61
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Data Imports & Exports


Upload Methods:
• Object Import Wizard Data in Format (CSV,TXT,Database)
• Data Loader
• Mass Transfer Maintain mapping format
• APEX Data API

Download Methods: Upload Method


• Reports
• Addins Creating Mapping
• SOQL
• DBAMP
• APEX Data Verifying Mapping

Upload File

Check for duplicates

Mapping Rules :

➢ Both attributes must use the same data type.


➢ The length of the target attribute must be equal to or greater than the source
attribute.
➢ You can specify an attribute as the target value only one time. However, you can
map an attribute from the source entity to multiple target schema names.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 62
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Monitoring
Setup > Administration Setup>Monitoring

Imports: An administrator can check the Import Queue to view details about an import or to
cancel an organization import.
Navigation: Setup > Administration Setup>Monitoring>Import

Outbound Messages: An administrator can view the Outbound Message queue to check the
status of outbound messages related to workflow or approval processes.
Navigation: Setup > Administration Setup>Monitoring> Outbound Messages
Time-Based Workflow: Specify criteria for monitoring the workflow queue, which contains
pending actions triggered by workflow rules.
Navigation: Setup > Administration Setup>Monitoring> Outbound Messages> Time-Based Workflow

Case Escalations: Specify criteria for monitoring the case escalation queue, which contains
pending actions triggered by case escalation rules.
Navigation: Setup > Administration Setup>Monitoring> Outbound Messages> Case Escalations

API Usage Notifications: Define a notification process that automatically sends email to a
specified user when API requests for an organization exceed the specified limit.
Navigation: Setup > Administration Setup>Monitoring> Outbound Messages> API Usage Notifications

Mass Emails: View the status of scheduled mass emails and cancel mass emails as
appropriate.
Navigation: Setup > Administration Setup>Monitoring> Outbound Messages> Mass Emails

Debug Logs: Specify the users for whom you want to retain the Apex debug logs in your
organization.
Navigation: Setup > Administration Setup>Monitoring> Outbound Messages> Debug Logs

Debug Log Includes:

- Salesforce user interface


- API
- executeanonymous calls
- Web services
- Email services

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 63
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Scheduled Jobs: View all the jobs scheduled to run by users, such as analytic snapshots and
dashboard refreshes.
Navigation: Setup > Administration Setup>Monitoring> Outbound Messages> Scheduled Jobs

Email Log Files: Request detailed summaries of email sent from Salesforce over the last 30
days.
Navigation: Setup > Administration Setup>Monitoring> Outbound Messages> Email Log Files

Bulk Data Load Jobs : Monitor the status of current and recent bulk data load jobs.
Navigation: Setup > Administration Setup>Monitoring> Outbound Messages> Bulk Data Load Jobs

Mobile Administration
Setup > Administration Setup>Mobile Administration

- To define a mobile configuration, click New Mobile Configuration.


- To creating data sets for a mobile configuration, click the name of the mobile
configuration, then click Edit in the Data Sets related list.
- To change the properties of mobilized objects, click the name of the mobile
configuration, then click Edit next to an object name in the Mobile Object Properties
related list.
- To customize mobile configuration tabs, click the name of the mobile configuration,
then click Edit in the Mobile Tabs related list.
- To create custom view for a mobile configuration, click the name of the mobile
configuration, then click Edit in the Mobile Views related list.
- To make changes to a mobile configuration, click Edit.
- To delete a mobile configuration, click Del.
- To view details about a mobile configuration, click its name.
- To clone a mobile configuration, select the mobile configuration you want to clone and
click Clone.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 64
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

- To activate a mobile configuration, click Edit next to the mobile configuration you want
to activate, select Active, and click Save. Deselect Active to deactivate the mobile
configuration.

Desktop Administration
Setup > Administration Setup> Desktop Administration

Outlook Configurations : Define the behavior of Salesforce for Outlook for your users,
including the Salesforce options that appear in the Outlook user interface, the data that syncs
between Salesforce and Outlook, and which users receive that data.
Navigation : Setup > Administration Setup> Desktop Administration > Outlook Configurations.

Offline Briefcase Configurations :Define the behavior of Connect Offline for your offline
users. Offline briefcase configurations are sets of parameters that determine which data
Salesforce transmits and which users receive that data in Connect Offline.
Navigation : Setup > Administration Setup> Desktop Administration > Offline Briefcase Configurations

- To create a briefcase configuration, click New Offline Briefcase Configuration.


- To define a data set for an offline briefcase configuration, click the name of the briefcase
configuration, then click Edit in the Data Sets related list.
- To make changes to a briefcase configuration, click Edit.
- To delete a briefcase configuration, click Del.
- To view details about a briefcase configuration, click its name.
- To clone a briefcase configuration, select the briefcase configuration you want to clone
and click Clone.
- To activate a briefcase configuration, click Edit next to the configuration you want to
activate, select Active, and click Save.
- To deactivate a briefcase configuration, click Edit next to the configuration you want to
activate, deselect Active, and click Save.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 65
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Email Administration
Setup > Administration Setup>Email Administration

Deliverability : Set up email delivery options that affect your entire organization.
Navigation : Setup > Administration Setup>Email Administration > Deliverability

- Bounced email : Email that is addressed to an invalid recipient and returned to the
sender. If a sender sends several email messages that bounce, the email server might
slow or block the delivery of all email from that sender.
- Noncompliant email : Email that does not comply with a recipient's email security
framework, such as the Sender Policy Framework (SPF), which verifies that the From
address in an email message is not forged.

Organization-Wide Addresses : Associate an email alias with each available user profile.
Navigation : Setup > Administration Setup>Email Administration > Organization-Wide Addresses

Compliance BCC Email : If your organization evaluates all outbound email messages for
compliance, you can enable compliance BCC emails to automatically send a hidden copy of
each outbound email message to an email address you specify. Enabling compliance BCC
emails prevents users from editing the BCC field on any email and disables their Automatic
Bcc setting under My Email Settings.
Navigation : Setup > Administration Setup>Email Administration > Compliance BCC Email

Email Relay Activation: Configure Salesforce to automatically route email through your
company's Simple Mail Transfer Protocol (SMTP) server.
Navigation : Setup > Administration Setup>Email Administration > Email Relay Activation

Test Deliverability : Verify your organization can receive email from every Salesforce IP
address.
Navigation : Setup > Administration Setup>Email Administration > Test Deliverability

Email To Salesforce: Automatically log emails you send from third-party email accounts as
activities on lead and contact records in Salesforce.
Navigation : Setup > Administration Setup>Email Administration > Email To Salesforce

Email Footers : Create footers for outgoing email.


Navigation : Setup > Administration Setup>Email fotters

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 66
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Personal Setup
My Personal Information
Setup > Personal Setup

Personal Information —Edit your user information, view login history, and more
Navigation: Setup > Personal Setup > Personal Information

Change My Password—Change your password .


Navigation: Setup > Personal Setup > Change My Password

Reset My Security Token—Reset the security token that you may need to log into
Salesforce from outside your company's trusted network .
Navigation: Setup > Personal Setup > Reset My Security Token

My Groups—Add, update, or delete your personal groups .


Navigation: Setup > Personal Setup > My Groups

Change My Display—Customize your display of tabs and related lists


Navigation: Setup > Personal Setup > Change My Display

Grant Login Access—Allow salesforce.com Customer Support representatives or your


administrator to log in to your account.
Navigation: Setup > Personal Setup > Grant Login Access

Calendar Sharing—Allow other users, personal and public groups, roles, or roles and
subordinates to view your calendar .
Navigation: Setup > Personal Setup > Calendar Sharing

Reminders—Set your personal preferences for activity


Navigation: Setup > Personal Setup > Reminders

Record Type Selection—Set your preferences for automatic selection of default record
types
Navigation: Setup > Personal Setup > Record Type Selection

Email
Navigation: Setup > Personal Setup >Email

My Email Settings—Set your outbound email settings

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 67
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

My Templates—Create and edit your own email templates

My Stay-in-Touch Settings—Set your preferences for emails requesting contact


information updates

Import
Navigation: Setup > Personal Setup >Import

Import My Accounts & Contacts—Import accounts and contacts that you own

Import My Person Accounts—Import person accounts that you own. Note that your
administrator may have customized the text of this link

Desktop Integration
Navigation: Setup > Personal Setup >Desktop Integration

Check for Updates—See what desktop client versions you have and install updates

Salesforce for Outlook—Install Salesforce for Outlook to integrate your data with
Microsoft® Outlook

Connect for Office—Install Connect for Office to integrate your data with Microsoft Word
and Excel

Connect Offline—Install Connect Offline to work remotely when you are not online

Connect for Lotus Notes—Download the Connect for Lotus Notes integration plug-in

My Chatter Settings
Navigation: Setup > Personal Setup >My Chatter Settings

My Feeds : Automatically follow records you created . Receive approval request as private
Chatter

Chatter Email Settings: Configure when and how frequently you want Chatter to send you
emails

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 68
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Social Accounts and Contacts


Navigation: Setup > Personal Setup > Social Accounts and Contacts

Settings—Configure the social networks and services that you want to use to see your
accounts', contacts', and leads' social information, or turn off the Social Accounts and
Contacts feature if you don't want to use it

DBAmp Administration
With DBAmp, you can easily access your Salesforce objects using SQL Select, Update, Insert and Delete
statements

➢ Make a Complete Backup of Salesforce Data


➢ Build Reports with Real-time or Mirrored Salesforce Data
➢ Integrate Local Applications with Salesforce.com
➢ SSIS and SSRS Support

DBAmp Properties :

⎯ Dynamic Parameters
⎯ Allow InProcess
⎯ Non transacted Updates

General Page Options

Linked Server: Enter SALESFORCE

Provider: Choose DBAmp OLE DB Provider

Product Name: Enter DBAmp

Location: If you are connecting to a sandbox, enter https://test.salesforce.com. Otherwise, leave blank.

Security Page Option :


For Remote Login:, enter your salesforce.com UserId.

For With password: enter your salesforce password.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 69
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Server Options:

Collation Compatible

Data Access

Use Remote Collation

RPC Out

Enable Promotion of Distributed Transactions

DBAmp Store Procedure :

➢ SF_Bulkops
➢ SF_Generate
➢ SF_ColCompare
➢ SF_Replicate
➢ SF_CreateKeys
➢ SF_DropKeys
➢ SF_CreateViews

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 70
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Connect Tab to Your Tab is now


Create Apps Create Object Create Tab
Object displayed on Solution

Create Field Sets Create Fields Create Field Sets

Create Layouts Search Layouts

Create Record Set

Create Buttons and


Links

Apps: An app is a group of tabs that work as a unit to provide functionality. Users can switch between
apps using the Force.com app drop-down menu at the top-right corner of every page.

Navigation: Setup > Create > Apps > New > Custom Apps > Specify a label for the app > Tab Selection >
Visible box to choose the user profiles

Objects: objects are database tables that allow you


to store information unique to your organization
Types of Object:
➢ Standard Object : Object
that’s are default out of box comes with Sales force account creation are called
standard object or system objects

➢ Custom Object : Custom objects are custom database tables that allow you to
store information unique to your organization

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 71
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

▪ Create custom fields. For the total number of custom fields you can create, see Salesforce Editions
and Limits.
▪ Associate the custom object with other records and display the custom object data in custom related
lists. For more information, see Overview of Relationships.
▪ Track tasks and events for custom object records
▪ Build page layouts
▪ Customize the search results and the custom object fields that display in them
▪ Create a custom tab for the custom object
▪ Create reports and dashboards to analyze custom object data
▪ Share your custom objects, custom tabs, custom apps, and any other related components with other
Salesforce users on Force.com AppExchange. See Overview of Packages.
▪ Import custom object records
▪ Set up a queue to distribute ownership of custom object records
Navigation : Setup | Create | Objects | New Custom Object

Custom Tab : custom tab is a user interface component you create to display custom object data or
other web content embedded in the application.

Types of custom tabs

➢ Custom Object Tabs display the data of your custom object in a user interface tab.
Custom object tabs look and function just like standard tabs.
➢ Custom Web Tabs display any external Web-based application or Web page in a
Salesforce tab. You can design Web tabs to include the sidebar or span across the entire
page without the sidebar.
➢ Apex Page Tabs display data from a Visualforce page. Visualforce page tabs look and
function just like standard tabs.

Navigation: Setup | Create | Tabs | New | Custom Tab

Custom Object
Custom Fields & Relationships :

Auto Number: A system-generated sequence number that uses a display format you
define. The number is automatically incremented for each new record.

Format Displayed Values


{0} 3

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 72
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Format Displayed Values


{000} 003
Sample- {00000} Sample- 00003 Sample- 00666 Sample- 10023
Value- {00} {MM} {DD} {YY} Value- 03 12 02 04 Value- 76 03 03 04 Value- 123 11 09 04
PO #{0} {MM}-{DD}-{YY} PO #12233 12-20-04 PO #25 06-07-04 PO #3 07-07-04

Formula: A read-only field that derives its value from a formula expression you define.
The formula field is updated when any of the source fields change.

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.

Lookup Relationship: Creates a relationship that links this object to another object. The
relationship field allows users to click on a lookup icon to select a value from a popup list.
The other object is the source of the values in the list.

Master-Detail Relationship: Creates a special type of parent-child relationship between


this object (the child, or "detail") and another object (the parent, or "master") where:

Checkbox: Allows users to select a True (checked) or False (unchecked) value.

Currency: Allows users to enter a dollar or other currency amount and automatically
formats the field as a currency amount. This can be useful if you export data to Excel or
another spreadsheet.

Date: Allows users to enter a date or pick a date from a popup calendar.

Date/Time: Allows users to enter a date and time, or pick a date from a popup
calendar. When users click a date in the popup, that date and the current time are entered
into the Date/Time field.

Email : Allows users to enter an email address, which is validated to ensure proper
format. If this field is specified for a contact or lead, users can choose the address when
clicking Send an Email. Note that custom email addresses cannot be used for mass emails.

Geolocation : Allows users to define locations.

Number: Allows users to enter any number. Leading zeros are removed.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 73
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Percent: Allows users to enter a percentage number, for example, '10' and automatically
adds the percent sign to the number.

Phone: Allows users to enter any phone number. Automatically formats it as a phone
number.

Picklist: Allows users to select a value from a list you define.

Picklist (Multi-Select): Allows users to select multiple values from a list you define.

Text :Allows users to enter any combination of letters and numbers.

Text Area: Allows users to enter up to 255 characters on separate lines.

Text Area (Long): Allows users to enter up to 32,768 characters on separate lines.

Text Area (Rich): Allows users to enter formatted text, add images and links. Up to
32,768 characters on separate lines.

Text (Encrypted): Allows users to enter any combination of letters and numbers and
store them in encrypted form.

URL: Allows users to enter any valid website address. When users click on the field, the
URL will open in a separate browser window.

Relation Ship: Relationships associate objects with other objects.

Master-detail(1:n)

This type of relationship closely links objects together such that the master record controls certain
behaviors of the detail and subdetail record

Behaviors of master-detail relationships include:

• When a master record is deleted, the related detail and subdetail records are also deleted.
• By default, records can’t be reparented in master-detail relationships. Administrators can,
however, allow child records in master-detail relationships on custom objects to be
reparented to different parent records by selecting the Allow reparenting option in the
master-detail relationship definition.
• The Owner field on the detail and subdetail records is not available and is automatically set
to the owner of the master record. Custom objects on the “detail” side of a master-detail
relationship can't have sharing rules, manual sharing, or queues, as these require the Owner
field.
• The security settings for the master record control the detail and subdetail records.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 74
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• The master-detail relationship field (which is the field linking the objects) is required on the
page layout of the detail and subdetail records.
• The master object can be a standard object, such as Account or Opportunity, or a custom
object.
• As a best practice, don't exceed 10,000 child records for a master-detail relationship.

Many-to-many
You can use master-detail relationships to model many-to-many relationships between any two
objects. A many-to-many relationship allows each record of one object to be linked to multiple
records from another object and vice versa.
Lookup
This type of relationship links two objects together, but has no effect on deletion or security. Unlike
master-detail fields, lookup fields are not automatically required. When you define a lookup
relationship, data from one object can appear as a custom related list on page layouts for the other
object..

Hierarchical
This type of relationship is a special lookup relationship available only for the user object. It allows
users to use a lookup field to associate one user with another that does not directly or indirectly
refer to itself.

Self-relationship
When an object has a lookup with itself, it is a self-relationship.

Validation Rules : Define a validation rule by specifying an error condition and a corresponding error
message. The error condition is written as a Boolean formula expression that returns true or false. When
the formula expression returns true, the save will be aborted and the error message will be displayed.

Page Layout : Page layouts define which fields users can view and edit when entering data for a custom
object record. You can use the default page layout that is created automatically when you create a custom
object. You can also build your own page layout with related lists and custom links.

Navigation : Setup | Create | Objects| Page Layout |New

Record Type : Record types allow you to offer different business processes, picklist values, and page
layouts to different users based on their profiles.

To create record types on a standard object:

1. Click Your Name | Setup | Customize, then select an object.

To create person account record types, click Your Name | Setup | Customize | Accounts | Person
Accounts.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 75
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

To create campaign member record types, click Your Name | Setup | Customize | Campaigns |
Campaign Members.

2. Click Record Types.


3. Click New.
4. Choose Master from the Existing Record Type drop-down list to copy all available picklist values, or
choose an existing record type to clone its picklist values.
5. Enter a Record Type Label that's unique within the object.
6. Enter a Record Type Name. This name can contain only underscores and alphanumeric characters,
and must be unique in your organization. It must begin with a letter, not include spaces, not end
with an underscore, and not contain two consecutive underscores. The Record Type Name refers to
the component when using the Web services API and prevents naming conflicts on package
installation in managed packages.
7. For opportunity, case, lead, and solution record types, select a business process to associate with the
record type.
8. Enter a description.
9. Select Active to activate the record type.
10. Select Enable for Profile next to a profile to make the record type available to users with that profile.
Select the checkbox in the header row to enable it for all profiles.
11. For enabled profiles, select Make Default to make it the default record type for users of that profile.
Select the checkbox in the header row to make it the default for all profiles.
12. Click Next.
13. Choose a page layout option to determine what page layout displays for records with this record
type:
o To apply a single page layout for all profiles, select Apply one layout to all profiles and choose
the page layout from the drop-down list.
o To apply different page layouts based on user profiles, select Apply a different layout for each
profile and choose a page layout for each profile.
14. Click Save to edit the values of the standard and custom picklists available for the record type, or
click Save and New to create another record type.

Custom Buttons and Links:

Display Type :

➢ Detail Page Link


➢ Detail Page Button
➢ List Button

Behavior :
➢ Display in New Window
➢ Display in existing window with side Bar
➢ Display in existing window with without side Bar
➢ Display in existing window with without side Bar or Header
➢ Execute Java Script

Content Source:

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 76
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

➢ URL
➢ Java Script
➢ Visual Force

Work Flow and Approval Process


Work Flow: Automation of an set process with step by step action is called workflow. A workflow rule
sets workflow actions into motion when its designated conditions are met.

Navigation: Setup | Create | Workflow & Approvals | Workflow Rules

Components of Workflow :
• Workflow Trigger (Condition)/Workflow Rule
• Workflow Criteria (Filtration)
• Workflow Action

Work Flow Triggers:


• Created
• created, and every time it’s edited
• created, and any time it’s edited to subsequently meet criteria

Workflow Criteria (Filtration):


• Filtration Criteria
• Formula Criteria
Workflow Action

• Email Alerts—Send an email to one or more recipients. For example, automatically send sales
management an email alert when a sales representative qualifies a large deal.
• Tasks—Assign a new task to a user, role, or record owner. For example, automatically assign
follow-up tasks to a support representative one week after a case is updated.
• Field Updates—Update the value of a field on a record. For example, automatically change the
Owner field on a contract three days before it expires.
• Outbound Messages—Send a secure configurable API message (in XML format) to a designated
listener. For example, automatically initiate the reimbursement process for an approved
expense report by triggering an outbound API message to an external HR system.

Types Of Workflow :
• Workflow Rule
• Time Bound Workflow

Work Flow Steps :

1. Select the object to which the workflow rule applies.


2. Configure the workflow rule settings and criteria.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 77
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

3. Configure the workflow actions.


4. Activate the workflow rule.

Approval Process : An approval process is an automated process your organization can use to
approve records in Salesforce.

(Navigation : Setup | Create | Workflow & Approvals | Approval Processes.)

Approval Process Steps:


1. Create an approval process.
2. Add steps to your approval process.
3. Specify initial submission actions.
4. Specify final approval actions.
5. Specify final rejection actions.
6. Specify recall actions.

Approval Process Components:


• Approval Actions : An approval action is an action that occurs as a result of an approval process.
• Approval Process : An approval process is an automated process your organization can use to
approve records in Salesforce. An approval process specifies the steps necessary for a record to be
approved and who must approve it at each step
• Approval Request : An approval request is an email or a Chatter post notifying the recipient that a
record was submitted for approval and that his or her approval is requested.
• Approval Steps : Approval steps assign approval requests to various users and define the chain of
approval for a particular approval process.
• Assigned Approver : A delegated approver is a user appointed by an assigned approver as an
alternate for approval requests. Delegated approvers can't reassign approval requests; they can only
approve or reject approval requests.
• Email Approval Response : The email approval response feature gives users the ability to approve
or reject email approval requests by replying to the email.
• Initial Submission Actions : Initial submission actions are the actions that occur when a user first
submits a record for approval. By default, an action to lock the record runs automatically on initial
submission
• Final Approval Actions : Final approval actions are the actions that occur when all required
approvals have been given for a record.
• Final Rejection Actions: Final rejection actions are the actions that occur when an approver rejects
the request and it goes to the final rejection state.
• Outbound Message: An outbound message is a workflow, approval, or milestone action that sends
the information you specify to an endpoint you designate, such as an external service.
• Recall Actions: Recall actions are the actions that occur when a submitted approval request is
recalled. By default, an action to unlock the record runs automatically on recall.
• Record Locking: Record locking is the process of preventing users from editing a record, regardless
of field-level security or sharing settings.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 78
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Packages
A package is a container for something as small as an individual component or as large as a
set of related apps. After creating a package, you can distribute it to other Salesforce users
and organizations, including those outside your company.

Unmanaged packages : Unmanaged packages are typically used to distribute open-source


projects or application templates to provide developers with the basic building blocks for an
application. Once the components are installed from an unmanaged package, the components
can be edited in the organization they are installed in. The developer who created and
uploaded the unmanaged package has no control over the installed components, and can't
change or upgrade them. Unmanaged packages should not be used to migrate components
from a sandbox to production organization

Managed packages : Managed packages are typically used by salesforce.com partners to


distribute and sell applications to customers. These packages must be created from a
Developer Edition organization. Using the AppExchange and the License Management
Application (LMA), developers can sell and manage user-based licenses to the app. Managed
packages are also fully upgradeable. To ensure seamless upgrades, certain destructive
changes, like removing objects or fields, cannot be performed.

Managed packages also offer the following benefits:

• Intellectual property protection for Apex


• Built-in versioning support for API accessible components
• The ability to branch and patch a previous version
• The ability to seamlessly push patch updates to subscribers
• Unique naming of all components to ensure conflict-free installs

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 79
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 80
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Module – 4
Sales force
Development
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 81
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

SFDC Development Flow

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 82
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Visual Force Development


Visualforce is a framework that allows developers to build sophisticated, custom user
interfaces that can be hosted natively on the Force.com platform. The Visualforce
framework includes a tag-based markup language, similar to HTML.

Visualforce primary elements

• Visualforce markup : Visualforce markup consists of Visualforce tags, HTML,


JavaScript, or any other Web-enabled code embedded within a single <apex:page>
tag. The markup defines the user interface components that should be included on the
page, and the way they should appear.

• A Visualforce controller : A Visualforce controller is a set of instructions that specify


what happens when a user interacts with the components specified in associated
Visualforce markup

MVC Architecture

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 83
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

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.

Visualforce System Architecture - Development Mode

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 84
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Visualforce System Architecture - Standard User Mode

Benefits of Visualforce

1. User-friendly development
2. Integration with other Web-based user interface technologies
3. Model-View-Controller (MVC) style development
4. Concise syntax
5. Data-driven defaults
6. Hosted platform
7. Automatically upgradeable

Language Construct :

<> In descriptions of syntax, less-than and greater-than symbols (< >)


are typed exactly as shown.
Eg : <apex:page>
{} In descriptions of syntax, braces ({ }) are typed exactly as shown.
Eg : <apex:page>
Hello {!$User.FirstName}!
</apex:page>
[] In descriptions of syntax, anything included in brackets is optional.
In the following example, specifying value is optional:
data_type variable_name [ = value];
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 85
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

| In descriptions of syntax, the pipe sign means “or”.


Set<data_type> set_name
[= new Set<data_type>();] |
[= new Set<data_type{value [, value2. . .] };] |

Creating VisualForce Page

01.http://na3.salesforce.com/apex/HelloWorld. Click Create Page <myNewPageName>


02. Setup > Develop > Pages > New

VisualForce Page Code/Structure

<apex:page>

< Write your Code Here>

</apex:page>
Eg:

<apex:page>
<!-- Begin Default Content REMOVE THIS -->

<h1>Congratulations</h1>
This is your new Apex Page: HelloWorld
<!-- End Default Content REMOVE THIS -->

</apex:page>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 86
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Custom Controllers : A custom controller is an Apex class that implements all of the logic for a page
without leveraging a standard controller.

Controller Methods:

• Action : Action methods perform logic or navigation when a page event occurs, such as when a user
clicks a button, or hovers over an area of the page. Action methods can be called from page markup
by using {! }

• Getter : Getter methods return values from a controller. Every value that is calculated by a
controller and displayed in a page must have a corresponding getter method, including any Boolean
variables.

• Setter : Setter methods pass user-specified values from page markup to a controller. Any setter
methods in a controller are automatically executed before any action methods.

StandardController : Default object can be accessed by using standard controllers


Eg:
<apex:page standardController="Account">
<p>Hello {! $User.FirstName}!</p>
<p>You are viewing the {! account.name} account.</p>
</apex:page>

List Standard Controllers :


• Account

• Asset

• Campaign

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 87
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• Case

• Contact

• Contract

• Idea

• Lead

• Opportunity

• Order

• Product2

• Solution

• User

• Custom objects

Components : Components are the syntaxes used in Visual Force page to control various
functionality and visual appearance of data or objects . Salesforce provides a library of
standard, pre-built components, such as <apex:relatedList> and <apex:dataTable>, that can
be used to develop Visualforce pages.

01 . apex:page - A single Visualforce page. All pages must be wrapped inside a single
page component tag.
Eg:
<apex:page renderAs="pdf">
<style> body { font-family: Arial Unicode MS; } </style>
<h1>Congratulations</h1>
<p>This is your new PDF</p>
</apex:page>

02. apex:pageBlock - An area of a page that uses styling similar to the appearance of a
Salesforce detail page, but without any default content.
Eg:
<apex:page sidebar="false">
<apex:pageBlock title="A Block Title">
<apex:pageBlockSection title="A Section Title">

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 88
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

I'm three components deep!


</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>

03. apex:pageBlockSection - A section of data within an <apex:pageBlock>


component, similar to a section in a standard Salesforce page layout definition.

04. apex:param : Passing parameter


Eg :
<apex:page standardController="Account">
<apex:pageBlock title="{!account.name}">
<apex:outputPanel id="contactDetails">
<apex:detail subject="{!$CurrentPage.parameters.cid}"
relatedList="false" title="false"/>
</apex:outputPanel>
</apex:pageBlock>
<apex:pageBlock title="Contacts">
<apex:form>
<apex:dataList value="{! account.Contacts}" var="contact">
<apex:commandLink rerender="contactDetails">
{! contact.Name}
<apex:param name="cid" value="{! contact.id}"/>
</apex:commandLink></apex:dataList>
</apex:form>
</apex:pageBlock>
</apex:page>

05. apex:pageBlockSection : A section of data within an <apex:pageBlock>


component, similar to a section in a standard Salesforce page layout definition.

Eg:
<apex:page standardController="Account">
<apex:form>
<apex:pageBlock title="My Content" mode="edit">
<apex:pageBlockButtons>
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!account.name}"/>
<apex:inputField value="{!account.site}"/>
<apex:inputField value="{!account.type}"/>
<apex:inputField value="{!account.accountNumber}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 89
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

06. apex:pageBlockSectionItem : A single piece of data in an <apex:pageBlockSection>


that takes up one column in one row. An <apex:pageBlockSectionItem> component can
include up to two child components.
Eg:
<apex:page standardController="Account">
<apex:form>
<apex:pageBlock title="My Content" mode="edit">
<apex:pageBlockButtons>
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>

<apex:pageBlockSection title="My Content Section" columns="2">


<apex:pageBlockSectionItem>
<apex:outputLabel value="Account Name" for="account__name"/>
<apex:inputText value="{!account.name}" id="account__name"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem>
<apex:outputLabel value="Account Site" for="account__site"/>
<apex:inputText value="{!account.site}" id="account__site"/>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem>
<apex:outputLabel value="Account Number" for="account__number"/>
<apex:inputText value="{!account.accountNumber}" id="account__number"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

07. apex:pageBlockTable : A list of data displayed as a table within either an


<apex:pageBlock> or <apex:pageBlockSection> component, similar to a related list or list
view in a standard Salesforce page
Eg:
<apex:page standardController="Account">

<apex:pageBlock title="My Content">

<apex:pageBlockTable value="{!account.Contacts}" var="item">

<apex:column value="{!item.name}"/>

</apex:pageBlockTable>

</apex:pageBlock>

</apex:page>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 90
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

08. apex:outputText : Displays text on a Visualforce page. You can customize the
appearance of <apex:outputText> using CSS styles
Eg:
<apex:page>
<apex:outputText style="font-style:italic" value="This is {0} text with {1}.">
<apex:param value="my"/>
<apex:param value="arguments"/>
</apex:outputText>
</apex:page>

09. apex:commandButton: A button that is rendered as an HTML input element with


the type attribute set to submit, reset, or image, depending on the <apex:commandButton>
tag's specified values. The button executes an action defined by a controller
Eg:
<apex:commandButton action="{!save}" value="Save" id="theButton"/>

10. apex:commandLink : A link that executes an action defined by a controller, and then
either refreshes the current page, or navigates to a different page based on the PageReference
variable that is returned by the action.
Eg: <apex:commandLink action="{!save}" value="Save" id="theCommandLink"/>

11. apex:dataList : An ordered or unordered list of values that is defined by iterating over
a set of data. The body of the <apex:dataList> component specifies how a single item should
appear in the list. The data set can include up to 1,000 items.
Eg:
<apex:page controller="dataListCon">
<apex:dataList value="{!accounts}" var="account">
<apex:outputText value="{!account.Name}"/>
</apex:dataList>
</apex:page>

/*** Controller: ***/

public class dataListCon {

List<Account> accounts;

public List<Account> getAccounts() {


if(accounts == null) accounts = [SELECT Name FROM Account LIMIT 10];
return accounts;
}

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 91
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

12. apex:dataTable : An HTML table that is defined by iterating over a set of data,
displaying information about one item of data per row.
Eg:
<apex:page controller="dataTableCon" id="thePage">

<apex:dataTable value="{!accounts}" var="account" id="theTable" rowClasses="odd,even" styleClass="tableClass">

<apex:facet name="caption">table caption</apex:facet>

<apex:facet name="header">table header</apex:facet>

<apex:facet name="footer">table footer</apex:facet>

<apex:column>

<apex:facet name="header">Name</apex:facet>

<apex:facet name="footer">column footer</apex:facet>

<apex:outputText value="{!account.name}"/>

</apex:column>

<apex:column>

<apex:facet name="header">Owner</apex:facet>

<apex:facet name="footer">column footer</apex:facet>

<apex:outputText value="{!account.owner.name}"/>

</apex:column>

</apex:dataTable>

</apex:page>

13. apex:detail: The standard detail page for a particular object, as defined by the
associated page layout for the object in Setup.
Eg:
<apex:page standardController="Account">
<apex:detail subject="{!account.ownerId}" relatedList="false" title="false"/>
</apex:page>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 92
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

14. apex:emailPublisher : The email publisher lets support agents who use Case Feed
compose and send email messages to customers.
Eg:
<apex:page standardController="Case" showHeader="true">
<apex:emailPublisher id="myEmailPublisher" entityId="{!case.id}" width="600px" title="Send an
Email" expandableHeader="false" autoCollapseBody="false" showAdditionalFields="false" fromVisibility="selecta
ble" toVisibility="editable" bccVisibility="hidden" ccVisibility="hidden" emailBody="" subject="" toAddresses=""
onSubmitFailure="alert('failed');" fromAddresses="person1@mycompany.com,person2@mycompany.com"
/>
</apex:page>

15. apex:form : A section of a Visualforce page that allows users to enter input and then
submit it with an <apex:commandButton> or <apex:commandLink>.
Eg:
<apex:form>
<apex:pageBlock>
<apex:pageBlockSection>
<apex:inputField value="{!account.name}"/>
<apex:inputField value="{!account.industry}"/>
<apex:commandButton action="{!save}" value="Save!"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

16. apex:iframe : A component that creates an inline frame within a Visualforce page. A
frame allows you to keep some information visible while other information is scrolled or
replaced.
Eg:
<apex:iframe src="http://www.salesforce.com" scrolling="true" id="theIframe"/>

17. apex:image : A graphic image, rendered with the HTML <img> tag.
Eg:
<apex:image id="theImage" value="/img/myimage.gif" width="220" height="55"/>

18. apex:inputCheckbox : An HTML input element of type checkbox


Eg:
<apex:page standardController="Opportunity" recordSetVar="opportunities" tabstyle="opportunity">
<apex:form id="changePrivacyForm">
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockButtons>
<apex:commandButton value="Save" action="{!save}"/>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 93
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

</apex:pageBlockButtons>

<apex:pageBlockTable value="{!opportunities}" var="o">


<apex:column value="{!o.name}"/>
<apex:column value="{!o.account.name}"/>
<apex:column headerValue="Private?">
<apex:inputCheckbox value="{!o.isprivate}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

19. apex:inputField : An HTML input element for a value that corresponds to a field on a
Salesforce object.
Eg:
<apex:form>
<apex:pageBlock>
<apex:pageBlockSection>
<apex:inputField value="{!account.name}"/>
<apex:inputField value="{!account.industry}"/>
<apex:commandButton action="{!save}" value="Save!"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

20. apex:inputFile : A component that creates an input field to upload a file. The maximum file
size that can be uploaded via Visualforce is 10 MB.
Eg:
<apex:page standardController="Document" extensions="documentExt">
<apex:messages />
<apex:form id="theForm">
<apex:pageBlock>
<apex:pageBlockSection>
<apex:inputFile value="{!document.body}" filename="{!document.name}"/>
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

/*** Controller ***/

public class documentExt {


public documentExt(ApexPages.StandardController controller) {
Document d = (Document) controller.getRecord();
d.folderid = UserInfo.getUserId(); //this puts it in My Personal Documents

}
}

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 94
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

21. apex:inputHidden : An HTML input element of type hidden, that is, an input element
that is invisible to the user.
Eg:
<apex:inputHidden value="{!inputValue}" id="theHiddenInput"/>

22. apex:inputText : An HTML input element of type text.


Eg:
<apex:inputText value="{!inputValue}" id="theTextInput"/>

23. apex:inputTextarea : A text area input element. Use this component to get user input for
a controller method that does not correspond to a field on a Salesforce object, for a value that
requires a text area.
Eg:
<apex:page standardController="Contract">
<apex:form id="changeDescription">
<apex:pageBlock>
<p>Current description: {!contract.description}</p>
<p>Change description to:</p>
<apex:inputTextarea id="newDesc" value="{!contract.description}"/><p/>
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlock>
</apex:form>
</apex:page>

24. apex:insert : A template component that declares a named area that must be defined by an
<apex:define> component in another Visualforce page.
Eg:
<apex:page>
<apex:outputText value="(template) This is before the header"/><br/>
<apex:insert name="header"/><br/>
<apex:outputText value="(template) This is between the header and body"/><br/>
<apex:insert name="body"/>
</apex:page>

25. apex:message : A message for a specific component, such as a warning or error. If an


<apex:message> or <apex:messages> component is not included in a page, most warning and error
messages are only shown in the debug log.

Eg:
<apex:message for="Location_validation" styleClass="locationError" /> <p />

26. apex:outputField : A read-only display of a label and value for a field on a Salesforce
object.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 95
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Eg: <apex:page standardController="Opportunity" tabStyle="Opportunity">


<apex:pageBlock>
<apex:pageBlockSection title="Opportunity Information">
<apex:outputField value="{!opportunity.name}"/>
<apex:outputField value="{!opportunity.amount}"/>
<apex:outputField value="{!opportunity.closeDate}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>

27. apex:outputLabel : A label for an input or output field. Use this component to provide a
label for a controller method that does not correspond to a field on a Salesforce object.
Eg:
<apex:outputLabel value="Checkbox" for="theCheckbox"/>
<apex:inputCheckbox value="{!inputValue}" id="theCheckbox"/>

28. apex:outputLink : A link to a URL. This component is rendered in HTML as an anchor


tag with an href attribute.
Eg:
<apex:outputLink value="https://www.salesforce.com" id="theLink">www.salesforce.com</apex:outputLink>

29. apex:outputPanel : A set of content that is grouped together, rendered with an HTML
<span> tag, <div> tag, or neither. Use an <apex:outputPanel> to group components together for
AJAX refreshes.
Eg: <apex:outputPanel id="thePanel">My span</apex:outputPanel>

30. apex:outputText : Displays text on a Visualforce page.


Eg :
<apex:page>
<apex:outputText style="font-style:italic" value="This is {0} text with {1}.">
<apex:param value="my"/>
<apex:param value="arguments"/>
</apex:outputText>
</apex:page>

31. apex:sectionHeader : A title bar for a page. In a standard Salesforce.com page, the title
bar is a colored header displayed directly under the tab bar.
Eg :
<apex:page standardController="Opportunity" tabStyle="Opportunity" sidebar="false">
<apex:sectionHeader title="One of Your Opportunities" subtitle="Exciting !"/>
<apex:detail subject="{!opportunity.ownerId}" relatedList="false" title="false"/>
</apex:page>

32. apex:selectCheckboxes : A set of related checkbox input elements, displayed in a table.


Eg :
<apex:page controller="sampleCon">
<apex:form>
<apex:selectCheckboxes value="{!countries}">
<apex:selectOptions value="{!items}"/>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 96
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

</apex:selectCheckboxes><br/>
<apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>
</apex:form>
<apex:outputPanel id="out">
<apex:actionstatus id="status" startText="testing...">
<apex:facet name="stop">
<apex:outputPanel>
<p>You have selected:</p>
<apex:dataList value="{!countries}" var="c">{!c}</apex:dataList>
</apex:outputPanel>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel>
</apex:page>

/*** Controller: ***/

public class sampleCon {


String[] countries = new String[]{};

public PageReference test() {


return null;
}

public List<SelectOption> getItems() {


List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));

return options;
}

public String[] getCountries() {


return countries;
}

public void setCountries(String[] countries) {


this.countries = countries;
}
}

33. apex:selectList : A list of options that allows users to select only one value or multiple
values at a time, depending on the value of its multiselect attribute.
Eg :
<apex:page controller="sampleCon">
<apex:form>
<apex:selectList value="{!countries}" multiselect="true">
<apex:selectOptions value="{!items}"/>
</apex:selectList><p/>

<apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>


</apex:form>

<apex:outputPanel id="out">

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 97
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

<apex:actionstatus id="status" startText="testing...">


<apex:facet name="stop">
<apex:outputPanel>
<p>You have selected:</p>
<apex:dataList value="{!countries}" var="c">{!c}</apex:dataList>
</apex:outputPanel>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel>
</apex:page>

/*** Controller: ***/

public class sampleCon {


String[] countries = new String[]{};

public PageReference test() {


return null;
}

public List<SelectOption> getItems() {


List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico'));
return options;
}

public String[] getCountries() {


return countries;
}

public void setCountries(String[] countries) {


this.countries = countries;
}
}

34. apex:selectOption : A possible value for an <apex:selectCheckboxes> or


<apex:selectList> component. The <apex:selectOption> component must be a child of one of those
components.
Eg :
<apex:page controller="chooseColor">
<apex:form>
<apex:selectList id="chooseColor" value="{!string}" size="1">
<apex:selectOption itemValue="red" itemLabel="Red"/>
<apex:selectOption itemValue="white" itemLabel="White"/>
<apex:selectOption itemValue="blue" itemLabel="Blue"/>
</apex:selectList>
</apex:form>
</apex:page>

/*** Controller ***/

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 98
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

public class chooseColor {


String s = 'blue';

public String getString() {


return s;
}

public void setString(String s) {


this.s = s;
}
}

35. apex:selectRadio : A set of related radio button input elements, displayed in a table. Unlike
checkboxes, only one radio button can ever be selected at a time.
Eg :
<apex:page controller="sampleCon">
<apex:form>
<apex:selectRadio value="{!country}">
<apex:selectOptions value="{!items}"/>
</apex:selectRadio><p/>
<apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>
</apex:form>
<apex:outputPanel id="out">
<apex:actionstatus id="status" startText="testing...">
<apex:facet name="stop">
<apex:outputPanel>
<p>You have selected:</p>
<apex:outputText value="{!country}"/>
</apex:outputPanel>
</apex:facet>
</apex:actionstatus>
</apex:outputPanel>
</apex:page>

/*** Controller ***/

public class sampleCon {


String country = null;

public PageReference test() {


return null;
}

public List<SelectOption> getItems() {


List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('US','US'));
options.add(new SelectOption('CANADA','Canada'));
options.add(new SelectOption('MEXICO','Mexico')); return options;
}

public String getCountry() {


return country;

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 99
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

public void setCountry(String country) { this.country = country; }


}

36. apex:stylesheet : A link to a stylesheet that can be used to style components on the
Visualforce page. When specified, this component injects the stylesheet reference into the head
element of the generated HTML page.
Eg :
<apex:stylesheet value="/resources/htdocs/css/basic.css"/>

37. apex:tab : A single tab in an <apex:tabPanel>. The <apex:tab> component must be a child
of a <apex:tabPanel>.
Eg :
<apex:page id="thePage">
<apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">
<apex:tab label="One" name="name1" id="tabOne">content for tab one</apex:tab>
<apex:tab label="Two" name="name2" id="tabTwo">content for tab two</apex:tab>
</apex:tabPanel>
</apex:page>

38 : Other Components : Please refer to Visual force components at Setup > Create >
Component > New > Component List

Sample Real Time Work Help


Sample Form Creation :
<apex:page standardController="Contact">
<apex:form>
<apex:pageBlock title="Quick Edit: {!Contact.Name}">
<apex:pageBlockSection title="Contact Details" columns="1">
<apex:inputField value="{!Contact.Phone}"/>
<apex:outputField value="{!Contact.MobilePhone}" label="Mobile #"/>
<apex:inputText value="{!Contact.Email}" label="{!Contact.FirstName + '’s Email'}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 100
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Setting the Tab Order for Fields in a Form


<apex:page standardController="Account">
<apex:form>
<apex:pageBlock title="Edit Account: {!Account.Name}">
<apex:pageBlockSection title="Account Details" columns="1">
<apex:inputField value="{!Account.Name}" tabIndex="4"/>
<apex:inputField value="{!Account.Website}" tabIndex="3"/>
<apex:inputField value="{!Account.Industry}" tabIndex="2"/>
<apex:inputField value="{!Account.AnnualRevenue}" tabIndex="1"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Building a Table of Data in a Page


<apex:page standardController="Account">
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are viewing the {!account.name} account.
</apex:pageBlock>
<apex:pageBlock title="Contacts">
<apex:pageBlockTable value="{!account.Contacts}" var="contact">
<apex:column value="{!contact.Name}"/>
<apex:column value="{!contact.MailingCity}"/>
<apex:column value="{!contact.Phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

Editing a Table of Data in a Page


<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account" sidebar="false">
<apex:form>
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockButtons>
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockButtons>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 101
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

<apex:pageBlockTable value="{!accounts}" var="a">


<apex:column value="{!a.name}"/>

<apex:column headerValue="Industry">
<apex:inputField value="{!a.Industry}"/>
</apex:column>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Creating Email Page


<apex:page controller="sendEmail">
<apex:messages />
<apex:pageBlock title="Send an Email to Your
{!account.name} Representatives">
<p>Fill out the fields below to test how you might send an email to a user.</p>
<br />
<apex:dataTable value="{!account.Contacts}" var="contact" border="1">
<apex:column >
<apex:facet name="header">Name</apex:facet>
{!contact.Name} </apex:column>
<apex:column >
<apex:facet name="header">Email</apex:facet>
{!contact.Email} </apex:column>
</apex:dataTable>

<apex:form >
<br /><br />
<apex:outputLabel value="Subject" for="Subject"/>:<br />
<apex:inputText value="{!subject}" id="Subject" maxlength="80"/>
<br /><br />
<apex:outputLabel value="Body" for="Body"/>:<br />
<apex:inputTextarea value="{!body}" id="Body" rows="10" cols="80"/>
<br /><br /><br />
<apex:commandButton value="Send Email" action="{!send}" />
</apex:form>
</apex:pageBlock>
</apex:page>

Dynamic Visualforce Bindings: Dynamic Visualforce bindings are a way of writing


generic Visualforce pages that display information about records without necessarily knowing
which fields to show. In other words, fields on the page are determined at run time, rather than
compile time.

Universal Objects:
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 102
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Order of Execution for Visualforce Page Get Requests


A get request is an initial request for a page either made when a user enters an URL or when a link or
button is clicked that takes the user to a new page.

Order of Execution for Visualforce Page Postback Requests


A postback request is made when user interaction requires a page update, such as when a user clicks on a
Save button and triggers a save action.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 103
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 104
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

APEX
APEX Development
Apex : Apex is a strongly-typed, object-oriented programming language that allows developers to
execute flow and transaction control statements on the Force.com platform server in conjunction
with calls to the Force.com API.

Apex is a strongly typed object oriented programming language


• It allows developers to execute flows and transaction control statements.
• Apex enables developers to add business logic to most system events like button clicks related record
updates and visual force pages.
• Apex Language

Characteristics of APEX:
i)Integrated : It provides built in support for DML calls
ii)Inline sales force object query language:
iii)Easy to use
iv)Easy to test
v) version
vi)Multi Tenant aware
When Should I use Apex:
• TO create email service
• Create webservices
• Perform complex validation over multiple objects.
• To create complex business processes that are not supported by work flow
• Create custom transaction logic.
• Attach custom logic to another operation.

How does Apex Work:


All the apex programs runs entirely ON-demand on Force.com Plat form.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 105
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• First the platform application server compiles the code into abstract set of instructions that can be
understood by Apex runtime interpreter.
• The compile code is stored to meta data.
• When the end user triggers the execution of Apex by clicking button or visualforce page the application
server retrieves the compiled interpreter before returning the result.

Object oriented programming (oops):


OOP is a methodology that provides a way of modularizing a program by creating partitioned memory are
for both data and methods that can be used as template for creating copies of such modules on demand.
Unlike procedural programming here in the OOP programming model, programs are organized around
objects and data rather than action and logic.
The main oops principles are
Encapsulation
Inheritance
Polymorphism
Encapsulation: The wrapping up of data and methods together is called encapsulation. For example, if we take a
class, we write the variables and methods inside the class. Thus, class is binding them together. So class is an
example for encapsulation.
Inheritance: it creates new classes from existing classes, so that the new classes will acquire all the features of
the existing classes is called Inheritance.
A good example for inheritance in nature is parents producing the children and children inheriting the
quantities of the parents.
Polymorphism: Polymorphism represents on form in multiple forms. In programming, we can use a single
variable to refer to objects of different types and thus, using that variable we call the methods of different objects.
Thus a method call can perform different tasks depending on the type of the object.

Apex fundamentals:
Data type:
• Data type in the apex tells about what type of data can be stored.
• What is the range of the data that can be stored.
I) primitive data types
ii) collections
iii) enums
primitive data types:
these are the data types which are predefined by the apex.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 106
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• A primitive data types such as an integer, double, long, data, date, time, string, id or Boolean.
• All primitive data types are passed by value not by reference.
• All apex variables, whether they are class member variables are initialized to null. Make sure that we
initialize variables to appropriate values before using them.

Apex primitive data types include:


Boolean: A value that can only be assigned true, false or null.
Eg: Boolean is active = false;
Date: A value that indicates a particular day. Date values contain no information about time. Date values must
always be created with a system static method.
Eg: date mydate = date.newinstance(2013,05,15);
Out put is 2031-05-15 00:00:00
Time and date time: these are date types associated with dates and times along with date data type. The time data
types stores times (hours, minutes , second and milliseconds). The date data tupes stores dates (year month and
day). The date time data type stores both dates and times.
Each of these classes has a new instance method with which we can construct particular date and time
values.
Eg: time t1 = new instance (19,20,1,20);
Out put is 19:20:01
• We can also creates dates and times from the current clock.
Date my = date time.now();
Date t = date.today();
• The date and time classes also have instance methods for converting from one format to another.
Time t2 = datetime.now().time();
• We can also manipulate the values by using a range of insatance method.
Eg: date t3 = date.today(0);
Date next = t3.adddays 930);
We will get something like this as the output.

2013-05-15 00:00:00
2013-06-16 00:00:00
Integer, long, double, and decimal:
To store numeric valurs in variables, declare variables with one of the numeric data types integer, long, double
and decimal.
Integer: a 32-bit number that doesn’t include a decimal poing integers have a minimum value of -2, 147, 483, 648
and a maximum value of 2,147,483,647.
Eg: integer i=1;
Long: a 64- bit number that doesn’t include a decimal poinglognshabe a minimum value of -263 and a maximum
value of 263-1.
Eg: long l = 2147483648l;
Double: a 64-bit number that includes a decimal point. Doubles have a minimum value of -263 and a maximum
value of 263-1.
Eg: doubles d = 3.14159;
Decimal: a number that include decimal point decimal is an arbitrary precision number. Currency fields are auto
matically assigned the type decimal.
Eg: decimal dec = 19.23;

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 107
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Null variables: if we declare a variable and don’t initialize it with a value, it will be null. Null means the absence
of a value we can also assign a null to any variable declared with a primitive type.
Both of these statements results in a variable set to null;
Boolean x = null;
Decimal d;
String: strings are set of characters and are enclosed in a single quotes. They store text values such as a name or
an address.
Eg: date d1 = date today();
String s = string value of (d1);
The out put of abouve examples should be todays date 2013-06-16.

SObject types:
An SObject can be a generic SObject or be a specific SObjects, such as an account, contact or mycustom__c.
• SObjects (short for “Salesforce objects”) are standard or custom objects that store record data in the
force.com data base. There is also an SObject data type in Apex that is the programmatic representation of
these SObjects and their data in code.
• Developers refer to SObjects and their fields by their API names.
Eg: account a = new account();
Mycustomobject__c CO = new mycustomobject__c();
API name of the custom object.
• The following example creates an invoice statement with some initial values for the description__c fields
and assign it to variables of tpe invoice – statement__c, which is anSObjecttupe also.
Eg: invoice – statement__cinv_new invoice-statement__c
(decription__c = ‘testinvoice; status__c = ‘pending’)
• SObject variables areinitialized to null, bu can be assigned a valid objext reference with the new operator.

Class: class is a collection of data members and methods.


Eg: class student
{
Integer no;
Strung name;
Public void get details()
{
System.debug (‘rollno’ + no);
System.debug (‘name’ + name);
}
}
Eg2: class exployee
{
Integer exp;
String department;
Void show()
{
//write the logic
}
}
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 108
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

To define an Apex class specify the following


i) Access modifiers:
• You must use one of the access modifiers for top level class. (public or global)
• You do not have to use access modifiers in the declaration inner classes.
ii) Optional definition modifiers such as virtual, abstract.
iii) Required: the keyword class followed by the class name.
iv) Optional extensions: AND/OR implementation.

Syntax:
Private/public/globla[virtual/abstract/with sharing / (none)]
Class class name [ implementsinterfacenamelist / (none) ] [ extends classname / (none) ]
{
// the body of the class
}

Access modifiers:
1) Private: if you declare a class a private it is only known to the block in which it is declared.]
By default all the inner classes are private.
2) Public: if you declare class as a public, this class is visible throughout your application and you can
access the application anywhere.
3) Global: if you declare a class a global this apex class is visible to all the apex applications in the
application or outside the application.
Note: if method or class (inner) is declare as global then the top level class also must be declared as
global.
4) With sharing: if you declare a class as a with sharing, sharing rules given to the current user will be taken
into the consideration and the user can access & perform the operations based on the permissions given to
him on objects & fields. (field level security, sharing rules)
5) Without sharing: if you declare a class as a without sharing then this apex class runs in system mode
which means apex code has access to all the objects and fields irrespective of current users sharing rules,
field level security, object permissions.

Note:
1) If the class is not declared as with sharing or without sharing then the class is by default taken as
2) Both inner classes and outer classes can be declared as with sharing.
3) If innerclass is declared as with sharing and top level class is declared as without sharing then by default
entire context will run in with sharing context.
4) If a class is not declared as with / without sharing and if this class is called by another class in which
sharing is enforced then both the classes run with sharing.
5) Outer class is declared as with sharing and inner class is declared as without sharing then inner class runs
in without sharing context only. (inner classes don’t take the sharing properties from outer class).
6) Virtual: if a class is declared with keyword virtual then this class be extended (inherited) or this class
methods can be overridden by using a class called overridden.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 109
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

7) Abstract: this class contains abstract methods.


Eg:
Public class outer class
{
//code
Class innerclass
{
//inner calss code
}
}
Eg:
publicwithout sharing class nosharing
{
//code
}
Eg:
Public with sharing class outer
{
//outer class code
Without sharing class inner
{
//inner class code
}
}
In the above code outer calss runs with current user sharing rules. But inner class runs with system context.
Eg:
Public without sharing class outer
{
//outer class code
With sharing class inner
{
//inner class code
}
}
In this both inner and outer classes runs with current users permissions.
Class variables:
The variables in the class should specify the following properties when they are defined.
i) Optional: modifiers such as public or final as well as static.
ii) Required: the data type of the variable, such as sharing or Boolean.
iii) Optional: the value of the variable
iv) Optional: the name of the variable.

Syntax:
[ public/private/protected / global/final] [static] data_typevariable_name.
Eg:
Private static final integer MY_INT;
Private final integer I = 1;

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 110
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Class methods:
To define a method, specify the following
i) Optional: modifiers, such as public or protected.
ii) Required: the data type of the value returned by the method, such as string or integer use void if the
method does not return a value.
iii) Required: a list of input parameters for the method separated by commas each preceded by its dat type
and enclosed in para n theses(). If there are no parameters use a set of empty parentheses. A method
can only have 32 input parameters.
iv) Required: the body of the method, enclosed in braces{}. All the code for the method including any
local variable declarations is contained here.

Syntax:
(public/private/protected/global) [override] [static] data_typemethod_name (input parameters)
{
// the body of the method.
}
Eg:
Public static interger get int()
{
Return my_int;
}
Public class example
{
Public integer show (integer age)
{
System.debug (‘my age is’ + age);
}
}

Object:
Object is a instance of the class. This has both state and behavior.
• Memory for the data members are allocated only when you create a object.

Syntax:
Classnameobjectname = new classname();

This is the name it’s a reference it is a keyword constructor


Of class for which variable which we are
We are creating allocating the memory
An object.
Eg:
Class example
{
//code
}
Example e = new example();
Constructor:

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 111
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Constructor is a special method which have the following properties.


i) Method name will be same as class.
ii) Access specifies will be public.
iii) This method will invoked only once that is at the time of creating an object.
iv) this is used to instantiate the data members of the class.

Eg:
Public class Testobject{
//the no argument constructor
{
//code
}
}
There are 3 types of constructors
1.default constructor.
2.non- parameterized constructor.
3.parameterized constructor.
1.defalut constructor:
If an apex class have doesn’t contain any constructor then apex complier by default creates a dummy constructor
on the name of class when we create an object for the class.
Eg:
Public class Example{
}
Example e =new Example();
In the above example the apex class doesn’t contain any constructor.so when we create object for example class
the apex complier creates a default constructor.
Eg:
Public example(){
}
2.non- parameterized constructor & parameterized constructor:
It is aconstructor that doesn’t have any parameters ,or constructor .
Eg:
Public class Example{
Integer rno;
String Name;
Public Example(Integer x, String myname){
rno=x; parameterized constructor
name=myname;
public Example(){
//code r.no=10; this is non-parameterized constructor
Name=sam;
}
Write a apex program to demonstrate usage of constructor.
1.open developer console by clicking the name no the salesforce page.
2.click file &select apex class.
3.enter the class name.
4.write the apex class.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 112
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Eg.
Public class Employee {
String Employee Name;
Integer Employee No;
Public Employee(){
EmployeeName=’hari’;
EmployeeNo=10;
}
Public void show(){}
System.debug(‘EmployeeName is ‘+EmployeeName);
System.debug(‘EmployeeNo is ‘+EmployeeNo);
]
}
5.open the anonymous block
Employee e1=new Employee();
Employee e12=new Employee();
e1.show();
e2.show();
this will give an output of EmployeeName is hari and EmployeeNo is 10.
-usage of apex program with within visual force page:
1.when you want to call apex class in visual force page we have to declare in the following format.
<apex:page controller = “class name”>
Whenever we call a visualforce page in which controller attribute is defined it will first create an object for the
apex class which is defined in controller.
2.whenobject is created for the apex class first it invokes the constructor.
Referring to the apex class members in visualforce:
When you want to refer apex class variables in the visual force page we need to use getter & setter methods.
Eg:
Public class Example{
String name;
}
Get method:when visual force page want to get the value of a variable defined in the apex .it will invoke get
method of that variable.
Eg:
<apex:output label>{!myname}</apex:outputlable>
This is a variable defined in apex class.
In the above statement visual force page is trying to use myname variable which is declared in apex class.so its is
invoke automatically getMyname() method in the apex class and this method will return the value of that .
Public class Example{
String name;
Public void set(String name){ setter method.this will take the value from the visual force page and
this.name=name; stores to the apex variable
}
Public string getName(){ getter method.this method will return a value to a visual force page
Return name; whenever a name variable is called.
}
}
Eg:

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 113
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Public class Example{


Integer no;
Public void set(string Integer no){
this.no=no;
}
Public integer getNo(){
Return no;
}
}
Write an example for getter method using visualforceand apex class
Ex class:
Public class Example{
String name;
Public String getName(){
Return ‘sam’;
}
}
Example page:
<apex:page controller=”Example”>
<apex:outputlabel>{!name}</apex”outputlable>
<spex:page>
->in the above programwhen the page is loaded first it creates an object for the example class.
->when outputlabel calls {!name} in the VF page it invokes getname() method n the controller class which will
retutn “sam”
o/p:- sam
apex class example :-
public class Example{]
String name;
Public Example(){
Name=’hari’;
}
Public String getName(){
return name;
]
}

Example page:-
<apex:page controller=”Example”>
<paex:outputlabel>your namae is {!nmae}</apex:outputlabel>
<paex:page>
o/p:
hari
write the values into apex variables from visual force page:
this is called read/write operation on the variable.
Ge:
{!page}
Public void setAge(Integer age){
this.age=age;

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 114
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

}
Eg:
{!name}
Public void setName(String name){
this.name;
}
Write an apex class to return the value to visual force page:
Apex class:
Public class example{
Public Integer age;
publicExample(){
age=10;
}
Pblic Integer aetAge(){
return age;
}
Public String getName(){
return ‘”samkumar”;
}
}
VF page:-
<apex:page controller=”Example”>
<apex:outputlabel>{!age}</apex:outputlabel>
<apex:outputlabel>{!name}</apex:outputlabel>
</apex:page>
Write an apex class to demonstrate setter method i.e.,
Passing the values and saving the values to apex variables:
Apex class:
Public class Example{
Pubic String name;
Public StirnggetName(){
Return name;
}
Public void setName(String name){
this.name=name;
}
}

VFpage:
<apex:page controller=”Example1”>
<apex:form>
<apex:outputlabel>Enter Name</apex:outputlabel>
<apex:inputText value=”{!name}”/>
<apex:commandButton value=”click”repender=”one”/>
<apex:outptlabelI”one”>your name is {! Name} </apex:outputlabel>
</apex;form>
</apex:page>
We can define setter and getter methods in a single line;

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 115
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Public Interger{set;get;}
How to call the apex methods in a visual force page:
Public class Demo{
Public pageReferenceshow(){
return null;//when we give returnnulll it will come back to same apge.
}
}
<apex:commandButton value=”click” action=”{!show}”/>
->when we click on the “click” button it will invoke pageReferenceshow() method.
->pageReference is the return type of every method that we have called from visual force page
Public page Example{
Public String name;
Public String getName(){
return name;
}
Public void setName(String name){
this.name=name;
}
Public pageReferenceshow(){
name=’this is my name’+name;
return null;
}
}
<apex:page controller=”Example1”>
<apex:form>
<apex:outputlabel>Enter name</apex:outputlabel>
<apex:inputText value=”{!name}”/>
<apex:commandButton value=”click”repender=”one”/>action=”{!show}”/>
<apex:outptlabel id=”one”> {! Name} </apex:outputlabel>
</apex:form>
</apex:page>
Eg:
Simple apex class to perform addition and subtraction bases on the button you have clicked
Public class Example1{
Public Integer bvalue{get;set;}
Public Integer bvalue{get;set;}
Public String operation{get;set;}
Public String pageReferencesub(){
Result =avalue-bvalue;
operation=’SUBREACTION’;
return null;
}
publicpageReferencesubb(){
result =avalue+bvalue;
operation=’ADDITION’;
}
}
<apex:page controller=”Example”>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 116
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

<apex:form>
<apex:pageBlocktitile =’caluculator’>
<apex:pageBlocksection columns=”1” titile =”sample operations” collapsible=”false”>
<apex:pageBlocksectionItem>
<apex:outputlabel>Enterr A value </apex:outputlabel>
<apex:pageBlocksectjionItem>
<apex:outputlabel>Enter B value </apex:outputlabel>
</apex:pageBlocksectionItem>
<apex:pageBlocksectionItem>
<paex:outputlabel>you have performed {!operation} of {!avalue}and {!bvlaue}and the result is
{!result}</apex:outputlabel>
</apex:pageBlocksectonItem>
</apex:pageBlocksection>
</apex:pageBlock>
</apex:page>

Collections Data
Topic Covered
1.arrays
2.program to display array of records in page block table.
3. program to create picklist field in vf page using arrays in apex
4.difference between array & collection.
5 .list introduction.
6.methods in the list.
7.program to demonstrate usage of list in apex.
8.example programs using list, apex& visualforce.
9.set introduction.
10..methods in set.
11.program to demonstrate usage of set in apex.
12.example programing using set,apex & visualforce.
13.map introduction.
14.list of methods in map.
15.program to demonstrate usage of map in apex.
16.example program using map,apex &visualforce.
17.example to create dynamic picklist using collections.

ARRAYS:-
Array is a collection of similar elements where the memory Is allocated sequently.
Datatype[] arrayname=new datatype[size];//this is dynamic declaration.
Datatype[] arrayname=new datatype[]{value1.value2};//static declaration.
Integer[] marks =new interger[]{10,20,30};
Account a1=new Account(name=’sam’);
Account a2=new Account(name=’ram’);
Account acc=new Account[]{a1,a2};
String[] s1=new string[]{‘ram,’sam’,’ram’};
String [] s1=new Stign[4];
S1[0]=’kumar’;

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 117
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

S1[1]=’ravi’;
Q: write a program to display array of strings in pageblock table
A: public class Arrayexample
{
Public string[]myval{set;get;}
Public String name{get;set;}
Public ArrayExample()
{
name=’prasad’;
myval=new string[] {‘sam’,’ram’,’krian’};
}
}
<apex:page controller=”ArrayExample”>
<apex:form>
<apex:pageBlock>
<apex:pageBlockTable value=”{!myval}”var=”a”>
<apex:column value=”{!a}”/>
</apex:pageBlockTable>
</apex:outputlabel>{!name}</apex:output>
</apex:pageBlock>
</apex:form>
<apex:page>
Q: write a program to display array of account records.
public class Arrayexample
{
public Account[] myval{set;get;}
public arrayExample()
{
Account a1= new Account (name =’sashi’,’Industry=’banking’);
Account a2=new Account (name =’ravi’,’Industry=’banking’);
Account a3=new Account (name =’pravee’,’Industry=’banking’);
Myval=new Account[] {a1,a2.a3};
}
}
<apex:page controller=”ArrayExample”>
<apex:form>
<apex:pageBlock>
<apex:pageBlockTable value=”{!myval}”var=”a”>
<apex:column value=”{!a.name}”/>
<apex:column value=”{!a.industry}”/>
</apex:pageBlockTable>
</apex:outputlabel>{!name}</apex:outputlabel>
</apex:pageBlock>
</apex:form>
<apex:page>
Picklist using selectoption from apex :-
1) <apex:selectList sixe=”1”>
<apex:selectoption intemLabel=”java” itemvalue=”scjp”/>
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 118
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

<apex:selectoption intemLabel=”java” itemvalue=”SDFC”/>


</apex:selectList>
In the apex program we can create same selectoption using a object selecoption.
Selectoption op1=new selectoption (itemvalue,itemlabel);

Public class selectExample{


Selectoption oop3= new selectopiton(‘null’,’non’);
Selectoption op1= new selectopiton(‘one’,’jan’);
Selectoption op2= new selectoption (‘two’,’feb’);
Myoptions =new selectoption []{op3,op1,op2};
}
}
<apex:page controller=”selectExample”>
<apex:form>
<apex:selecctList size=”1”>
<apex:selectoptions value=”{!myoptions}”></apex:selectooptions>
</apex:selectList>
<apex:selectList size=”1”>
<apex:selecctoption itemLabel=”java” itemvalue=”java”></apex:selectoption.
<apex:slectoption tiemLabel=”SFDC” itemvalue=”SF”></apex;selectoption.
</apex:selectList>
</apex:form>
</apex:page>

Collections:-
Difference b/w array and collections
Array
1.array is a collection of Homogeneous (similar) Elements.
2.arrays cannot grow and shrink dynamically.
3.arrays can be accessed faster and less memory.

collections
1. It is a collection of Homogeneous & heterogeneous elements.
2. It can grow and shrink dynamically.
3. Collections are sow compare to arrays and consume more memiry.

List :
List is an interface.
A list is an ordered collection of elements that are distinguished by their indices.
List elements can be of any data type primitive types, collections,sobjects,user-defined types and built
in apex types.
Index0 index1 index2 index3 index4
Green blue yellow red black
Insertion order is preserved.
Can grow dynamically at run time.
duplicate values are accepted.
Methods in list class:

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 119
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Add(object):- adds an element to the end of the list.


Add (interger,object):- inserts an elements into the list at the specified index position.
Addall (list):- adds all of these elements in the specified list to the list that calls the method. both lists
must be of the same type.

Addall(set):- add all of the elements in specified set to the list that calls the method.the set and the list
must be of the same type.

Clear():- removes all elements from a list, consequently setting the lists length to zero.
Clone():- makes a duplicate copy of a list.
Deepclone (Boolean,Boolean,Boolean):- maker a duplicate copy of a list subject records, including the
sobjects records themselves.
Euals (list):- compares this list with the specified list and returns true if both lists are equal. Otherwise
returns false.
Get (integer):- returns the list elements stored at the specified index.
Get sobjecttype():- returns the token of the subject type that makes up a list of sobjects.
Hashcode:- returns the hashcode corresponding to this list and its contents.
Isempty():- returns true if the list has zero elements.
Remove (integer):- remove the list elements stored at he specified index, returning the elements that
was removed.
Set(integer, object):- sets the specified value for the elements at the given index.

Size():- returns the number of elements in the list.


Sort():- sorts the items in the list in ascending order.
Eg:- List<String> str=new List<String>();
String s1=’sam’;
String s2=’Ram’;
String s3=’Ravi’;
Str.add(s1);
Str.add(s2);
Str.add(1,s3);
List<String>finalist=new List<String>();
Finalist.addAll(str);
String x=str.get(1);//Ravi
➔ Write a Program to demonstrate the list
public class ListExample{
public List<String>result{set;get;}
public ListExample()
{
result=new List<String>();
result.add(‘sam’);
result.add(‘ram’);
result.add(‘hari’);
result.add(1,’kumar’);
}
}
<apex:page Controller=”ListExample”>
<apex:pageBlock>
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 120
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

<apex:pageBlockTable value=”{!result}” var=”a”>


<apex:column value=”{!a}”/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
List of Objects Demo:-
public class ListExample{
public List<Account>result{set;get;}
public ListExample()
{
Account a1=new Account(name=’sam’ Industry=’Banking’);
Account a2=new Account(name=’ram’ Industry=’Energy’);
result=new List<Account>();
result.add(a1);
result.add(a2);
}
}
Create a list of apex class Objects:-
1.Student Apex:-
global class Student
{
public String name{get;set;}
public Integer age{get;set;}
public Student(String name,Integer age)
{
this.name=name;
this.age=age;
}
}
2.ListExample Apex:-
public class ListExample
{
public List<Student>result{set;get;}
public ListExample()
{
result=new List<Student>();
Student s1=new Student(‘sam’,20);
Student s2=new Student(‘Ram’,40);
Student s3=new Student(‘praveen’,40);
result.add(s1);
result.add(s2);
result.add(s3);
}
}
ListExample VisualForce:-
<apex:page Controller=”ListExample”>
<apex:pageBlock>
<apex:pageBlockTable value=”{!resulr}” var=”a”>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 121
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

<apex:column value=”{!a.name}”/>

Set:
It is an ordered collection of elementswhere elements can be of any data type.Premitivetypes,collections, s
objects,user defined types,and built in Apex types.

1.Set don’t allow the duplicate values.


2.Insertion order isnot preserved in the set.
3.It grow dynamically at run time.

Ex:
Set<string> names = new ser<string> ();
Set<Account>acc = new ser<Account> ();
Set<Customer__c>mycustomers = new ser<Customers__c> ();
Public void add(object)//this method will ass elements to the set.
Set<string> names = new ser<string> ();
Names.add (‘one’);
Names.add (‘two’);
Names.add (‘one’);
NOTE:Set will not allow duplicates,but if we insert it will not raise any error it will not takes value.
Public void add all (list) // this method will add all elements to the set.
List <string>mylist = new List <string> ();’
Mylist.add (‘one’);
Mylist.add (‘two’);
Set <string>mynames = new set <string>();
Mynames.add (‘vedha’);
Mynames.addall (mylist);
Public integers size () // this method will return no. of elements in the set.
Set <string> names = new set <string>();
Names.add (‘one’);
Names.add (‘two’);
Names.add (‘one’);
Integer mysize = names.size(); // this will return 3 and stored to my size variable.
Public void remove (integer index ) // this method will remove the elements at the specified index.
Name.remove (1);
Example:- write an apex class to demonstrate set.
public class SetExample
{
public Set<String>names{get;set;}
public SetExample()
{
names=new Set(String>();
names.add(‘one’);
names.add(‘two’);
names.add(‘sam’);
names.add(‘one’);
names.add(‘one’);

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 122
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

}
}

Vf page:
<apex: page controller = “set example”>
<apex:pageblock>
<apex:pageblock table value = “{!names}” var = “a”>
<apex: column value = “{!a}”/>
</apex:pageblocktable>
</apex:pageblock>
</apex:page>
➔ Write an apex class to add list of elements to set.

Public class setExample


{
Public set<String> names{get;set;}
Public setExample()
{
List<string>mylist=new list<String>();
Mylist.add(‘sashi’);
Mylist.add(‘rakesh’);
Mylist.add(‘rakesh’);
Names=new set<String>();
names.add(‘one’);
names.add(‘two’);
names.add(‘one’);
names.add(‘one’);
names.add(mylist);
}
}
Public void retain all (list) // this will keep only the values that are existing in list and set.
Remove rest of the values.
Public class set example
{
Public set <string> name {get;set;}
Public Boolean test {get;set;}
Public set example ()
{
List <string>mylist = new list <string> ();
Mylist.add (‘vedha’);
Mylist.add (‘Manot’);
Names = new set <string>();
Names.add (‘vedha’);
Names.add (‘Manoj’);
Names.add (‘kumar’);
Test = names.retainall (mylist);
}
Visual force page:
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 123
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

<apex:page controller = “setexample”>


<apex:pageblock>
<apex:outputlable> {!test} </apex:outputlable>
<apex:datalist value = “{!names}” var = “a”> {!a}
</apex:datalist>
</apex:pageblock>
</apex:page>
Visual force page:
<apex:page controller = “setexample”>
<apex:pageblock>
<apex:outputlable> {!test} </apex:outputlable>
<apex:datalist value = “{!names}” var = “a”> {!a}
</apex:datalist>
</apex:pageblock>
</apex:page>

Map:
A map is a collection of key-value pairs where each unique key maps to a single value. Keys and vaues can be
any data tupe – primitive types, collections, sobjects, user-defined types, and built-in apex types.
For eg, the following table represents a map of countries and currencies.
Country (key ‘united ‘japan’ ‘france’ ‘england’ ‘india’
states’
Currency ‘doller’ ‘yen’ ‘euro’ ‘pound’ ‘rupee’
(value)

Clear(): remove all of the key-value mappings from the map.


Clone(): makes a duplicate copy of the map.
Countans key (object): returns true if the map contains a mapping for the specified key.
Deepclone (): makes a duplicate copy of a map, including subject records if theis is a map with subject recored
values.
Equals(map): compares this map with the specified map & returns true if both maps are equal otherwise returns
false.
Get (object): returns the value to which the specified key is mapped or null if the map contains no value for this
key.
Get subject type ():retunsthe taken of the subject type that makes up the map values.
Hashcode(): returns the hashcodecorrensponding to this map.
Isempty(): returns true is the map has zero key-value pais
Keyset(): returns a set that contains all of the keys in the map.
Put (object,object): associates the specified value with the specified key in the map.
Put all(map) : copies all of the mappings from the specified map to the original map.
Put all (subject): adds the list of subject records to a map declared as map <id, subject> or map <string, subject>
Remove(key): removes the mapping for the specified key from the map, if present and returns the corresponding
value.
Size(): returns the no. of key-value pairs in the map.
Values(): returns a list that contains all of the values in the map in arbitrary order.
Set of key: key can not be duplicate
List of values : it allows duplicates.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 124
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Map<integer,string> my = new map<integer,string>();


Set <integer > keys = list <string> values
Void put (key,value)
m.put (1,’vedha’):
m.put (2,’Manoj’):
m.put (3,’Kumar’):
{1--→ ‘vedha’, 2--→ ‘Manoj’, 3--→ ‘Kumar’}
---→ set<subject>keyset(): If we use this method we will get set of keys.
Set<integer> s = m.keyset(); {1,2,3}
--→ list<subject>values(): It will return list of values in the map.
List <string>val = m.values(); {‘vedha’, manoj’, ‘kumar’}
Public class depend example {
Public page reference show() {
List <string> bran = mybrances.get(mycity);
Branch.clear();
For (string x:bran)
{
Select option opi = new selectoption (x,x);
Branch.add (opi);
}
}
Apex class:
Public string mycity{ get;set;}
Map <string, list <string>>mybranches = new map <sring, list <string>>();
Public list <selectoption> city {set;get;}
Public list <selectoption> branch {set;get;}
Public dependexample()
{
List <string>hyd = new list <string> ();
Hyd.add (‘srnagar’);
Hyd.add (‘ameerpet’);
List <string> bang = new list <string>();
Bang.add (‘btm’);
Bang.add (‘madiwala’);
Mybranches.put (‘hyd’, ‘hyd’);
Mybranches.put (‘bang’, ‘bang’);
Set <string> keys = mybranches.keyset ();
City = new list <selectoption>();
Branch = new list <selectoption>();
City.add (new selectioption (‘null; ‘none’));
List <string> my = new list <string>();
My.add (‘none’);
For (string a: keys)
{
Selectoptionopi = new selectoption (a,a);
City.add (op1);
}
}

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 125
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

}
Vf page:
<apex:page controller = ‘dependexample”>
<apex:from>
<apex: selectlist value = ‘{!mycity}” size = ‘1’>
<apex:selectoptions value =”{!city}”></apex:selectoptions>
<apex:actionsupport event = “onchange” action = “{!show}”
Rerender = “one”/>
</apex:selectlist>
<apex:selectlist size = “1” id = “one”>
<apex:selectoptions value = “{!branch}”>
</apex:selectoptions>
</apex:selectlist>
</apex:form>
</apex:page>
Example:
Apex class:
Public class list & maps controllers
{
Public map <string, string >inputfields {get;set;}
Public listsMapsController ()
{
InputFields = new Map<string, string>
{
‘first Name’ ‘johney’, ‘lastName’ ‘Applessed’, ‘age’
‘42’};
}
Public pageReferencesubmitFieldDate()
{
DosomethingInteresting with Input();
Return null;
}
Public void dosomethingInteresting with Input()
{
inputFields.put (‘age’, (Integer.valueof(inputFields.get(‘age’)) + 10).format());
}
}
<apex:page controller = “ListsMapsController”>
<apex:outputpanel id = “box” layout = “block”>
<apex:pageMessages/>
<apex:form>
<apex:repeat value = “{!inputFields}” var = “fieldkey”>
<apex:output text value = “{!fieldkey}”/>
<apex:input Text value = “{!inputFields [fileld key]}”/><br/>
<apex:commandButton action =”{!submitFieldData}”
Value = “submit” id = “button” rerender = “box”/>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 126
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Assignment Statements : An assignment statement is any statement that places a


value into a variable
Eg : Integer i = 1;
Account a = new Account();
Account[] accts = [SELECT Id FROM Account];

Conditional (If-Else) Statements :


Conditional Statement Structure :
if ([Boolean_condition])
// Statement 1

else // Statement 2

Eg :
if (place == 1) {
medal_color = 'gold';
} else if (place == 2) {
medal_color = 'silver';
} else if (place == 3) {
medal_color = 'bronze';
} else {
medal_color = null;
}

Loops : Apex supports the following five types of procedural loops


• do {statement} while (Boolean_condition);
• while (Boolean_condition) statement;
• for (initialization; Boolean_exit_condition; increment) statement;
• for (variable : array_or_set) statement;
• for (variable : [inline_soql_query]) statement;

Do-While Loops : The Apex do-while loop repeatedly executes a block of code as long as
a particular Boolean
Eg :
do {
code_block
} while (condition);

Eg :
Integer count = 1;

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 127
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

while (count < 11) {


System.debug(count);
count++;
}

While Loops : The Apex while loop repeatedly executes a block of code as long as a
particular Boolean condition remains true.

Construct :
while (condition) {
code_block
}

Eg :
Integer count = 1;
while (count < 11) {
System.debug(count);
count++;
}

For Loops : Apex supports three variations of the for loop:

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 128
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

SOQL Queries:
Salesforce object query language is used to quiry the records from the database.com based on the requirement.
There are 2 types of SOQL Statements.
1) Static SOQL: the static SOQL Statement is written in [] (array brackets).
This statements are similar to LINQ.
Eg: string search for = ‘Jones’;
Contact[] contacts = [select testfield__c, firstName, LastName from contact where Lastname = :searchfor];
2) Dynamic SOQL: It is used to refer to the creation of a SOQL string at run time with Apex code.
Dynamic SOQL enables you to create more flexible application.
To create Dynamic SOQL query at run time use Database.query() method in one of the following ways.
Return a single subject when the query returns a single record.
Subject s= Database.query(string_limit_1);
Return a list of sobjects when the query returns more than a single record.
Examples:
Eg1:
String myteststring = ‘TestName’;
List <sobject> L = Database.query (‘SELECT ID FROM MY Custom Object__(WHERE Name = :mytestString);
Eg2:
String resolvedField1 = myvariable.field1__c’;
List <sobject> L = Database.query (‘SELECT ID FROM MY CustomObject__(WHERE field__c =
‘resolvedField1);
Syntax for SOQL query:
SELECT field1, field2,… FROM ObjectType [WHERE condition]
Examples:
List <Account>acc = [select Id, Name from Account];
List <Account>acc = [select Id, Name from Account where annual revenue <10000];
2) Write a query to fetch customer Name, Balance from customer object where balance is more than 100000.
List <customer_c> customers = [select Id, customer_Name_c,
Balance_c from customer_c where Balance__c>100000]
3) write a query to fetch Id, type_c from transaction if mode is ‘cash’
List <transaction_c>tra = [select Name, Type__c from transaction__c where Mode__c = ‘cash’]
NOTE:
If the value does not equal any of the specified values and a WHERE class.
Eg: SELECT Name FROM Account
WHERE Billingstate NOTIN (‘Texas’, ‘NewYOrk’)
Subquery:
The query with in a query is called subquery.
1) Write a query to return list of accounts that do not have any open opportunities.

Any open opportunities


SELECT Id FROM Account WHERE Id NOTIN
(
SELECT AccountId-→ Account Id is a lookup field in the opportunity
FROM opportunity
WHERE Is closed = false
)

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 129
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Eg2:
SELECT Id FROM opportunity WHERE AccounId NOTIN
(
SELECT AccountId
FROM Contact
WHERE LeadSource = ‘Web’
)
Note: whenever we create a master-detail or lookup field id of the master record is stored in this field.
Date formats:
When you want to use the date formats in query, it should be any one of the below formats.
Format format syntax example
Date only YYYY-MM-DD 1991-02-06
Date,tme& time YYYY-MM-DD+hh:mm:ss 1991-02-06+14:02:03+01:00
Zone offser +hh:mm
Limit:
Use limit to specify the maximum no. of rows to return.
Syntax:
SELECT fieldList FROM ObjectType [WHERE ConditionExpression]
LIMIT number_of_rows
Eg:
SELECT Name FROM Account WHERE Industry = ‘Media’ LIMIT125
Note: you cant use a LIMIT clause In a query that uses an aggregate function, but does not use a GROUP BY
Clause.
For example, the following queru is invalid.
SELECT MAX (createdDate)
FROM Account LIMIT1.
OFFSET:
Use OFFSET to specify the starting row offset into the result set returned by your query.
• Using OFFSET is helpful for paging into large result sets, in scenarios where you need to quickly jump to
a particular set of the entire results.
Syntax:
SELECT field List FROM Object Type [WHERE Condition Expression] ORDER BY field order by list LIMIT
number_of_rows_to_return
OFFSET number_of_rows_to_skip
Eg:
SELECT Name FROM merchandise_c WHERE price_c>5.0 ORDER By name LIMIT 100
OFFSET 10.
GROUP BY:
With API version 18.0 and later, you can use GROUP BY with aggregate functions, such as SUM() or MAX(), to
summarize the data and enable you to rollup query results rather than having to process the individual records in
your code.
Syntax:
[GROUP BY field GROUPBYLIST]
EG1:
Select leadsoucefro lead.
Eg2:
Select leadsource, COUNT(name) FROM lead groupbyleadsource.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 130
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Eg:
Select leadsource from lead group by leadsource.
Note:
You must use a group by clause if your query uses a limit clause and an aggregated function.
Eg:
Select name, max (created date) from account group by name limit 5.
Group by rollup:
This allows the query to calculate subtotals so you have to maintain that logic in your code.
Syntax:
[group by rollup ([field nam1, fieldname2, fieldname3])]
Eg1: rolls the results up by one field select leadsource, count(name) cnt from lead group by rollup (leadsource)
Eg2:
Rolls the results up by two fields select status, leadsource, count(name) cnt from lead group by rollup (status,
leadsource)
Group by cube:
This is particular useful if you need to compile cross-tabular reports of your data use group by cube with
aggregate functions, such as sum() and count(fieldname)
Syntax:
[group by cube ([fildname1, fieldname2, fieldname3])]
Eg: returns subtotals of accounts for combination of type @billing city
Select type billing country grouping (type) grptype, grouping (billing country) grpcty, count(id) accts
From account group by cube (type, billing country) order by cube (type), grouping (billingcountry)
Having:
With API version 18.0 and later, you can use a having clause with a group by clause to filter the results returned
by aggregate functions, such as sum().
Syntax:
[HAVING having condition expression]
Eg1:
Determine how many leads are associated with each leadsource.
Select leadsource, count(name) from lead group lead group by leadsource
Eg2:
Generate more than 100 leads
Select leadsource, count(name) from lead groupbyleadsource having count(name)>100.
Eg3:
Returns accounts with duplicate names
Select name, count(id) from account gropu by name having count(id)>1
Relationship queries:
When you want to write a queries based on parent child relationship will be using relationship queries on standard
& custom objects
• There are two types of relationship queries.
1) Child to parent relationship
2) Parent to child relationship
1) Child to parent relationship:

Child to parent relationship

contact Rupom Chakraborty - Capital Info Solutionsaccount


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 131
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Name= account

• In the above diagram contact is a child of account object.


• In the child to parent relationship name will be parent object which means foreign key is in account objct
Eg:
Select contact.firstname, contact.account.anem from contact
Eg:
Write a query to fetch list of contacts and account names from contact objects where account.industry =
‘media’.
Child to parent on custom object:

Child to parent relationship

Name = parent
Child__c Parent__c

Note: When we use relationship name for the custom objects in SOQL query we should append object name__ r
to the relationship name.
Eg:
List<child__c>ch = [select id, anem, parent__r.first name, parent__r.lastname__c from child__c where
age__c<25];

Eg

Relationship name = custom

Transaction__c Customer__c

Child object parent object


Note: When you are writing a query fro child to parent relationship always relation name will be master_detail
field name or lookup filed name.
Eg: Write a query to fetch list of transactions along with account type and customer names whose transaction
type is deposit.
Note:Master_detail field in the transaction is customer details__c
List <transactions__c> + r = [select id, customerdetails_r. cname__c, customerdetails__r. accounttype__c, name
from transaction__c];
Write a apex program to display first five contact details from contact obhect along with axxont name and
industry
Apex class:

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 132
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Public class childparent


{
Public list<contact>cont {get;set;}
Public pagereferenceshow()
{
Cont = [select id, anem, account.name, account.industry from contact limit 5];
Return null;
}
}
Vfapge:
<apex:page controller = “childparent”>
<apex:form>
<apex:pageblock rendered = “{!NOT(IS NULL(CONT))}”>
<APEX:pageblocktable value = “{!cont}” var = “a”>
<apex:column value =”{!a.name}”/>
<apex:column value =”{!a.account.name}”/>
<apex:column value =”{!a.account.industry}”/>
</apex:pageblocktable>
</apex:pageblock>
<apex:command button value = “click” action = “{!show}”/>
</apex:form>
</apex:page>
SOSL Statements:
SOSL Statements evaluate to a list of sobjects, where each list contains the search results for a particular subject
type. The result lists are always returned in the same order as they were specified in the SOSL query.
• If a SOSL query does not return any records for a specified sobject type, the search results include an
empty list for that sobject.
• For example, you can return a list of accounts, contacts, opportunities and leads that begin with the phrase
map.
List <list<SObject>>searchlist = [FIND ‘map*’ IN ALL FIELDS RETURNING Account (id, anem), contact,
oopertunity, lead];
Note:
The syntax of the FIND clause in Apex differs from the syntax of the of the FIND clause in the SOAP API.
• In Apex, the volue of the FIND clause is detercated with single quotes.
FIND ‘map*’ IN ALL FIELD RETURNING Account (id, anem), contact, opportunity, lead.
• In the force.com API, the value of the FIND clause is demarcated with braces.
Eg:
FIND {MAP*} IN ALL FIELDS RETURNING Account (id, name), contact, opportunity, lead.
From search list, you can create arrays for each object returned
Account [] accounts = ((List <Account>) searchList[0]);
Contact [] Contacts = ((List <contact>) searchList[1]);
oppertunity []oppertunities = ((List <oppertunity>) searchList[2]);
lead [] leads = ((List <lead>) searchList[4]);
dynamic SOSL:
Dynamic SOSL refers to the creation of a SOSL string at runtime with Apex code.
• Dynamic SOSL enables you to create more flexible applications.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 133
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

For example, you can create a search based on input from an end user or update records with varying field names.
• To create a dynamic SOSL query at runtime, use the search query method.
For example
List <list<SObject>>myquery = search.query (SOSL_search-string)
The following example excercises a simple SOSL query string
String searcquery = ‘FIND\’EDGE*\’ IN ALL FIELDSRETURNING Account (id, name), contact, lead’;
List <list<SObject>>searchlist = search.query(searcquery);
• Dynamic SOSL statements evaluate to a list of lists of SObjects, where each list contains the search results
for a particular SObjecttype. The result lists are always returned in the same order a sthey were specified
in the dynamic SOSL query.
• The search quiery method can be used where ever an inline SOSL quiery can be sued such as in regular
assignment statements and for loops.

SOSL Example:-
Public with Sharing class DeferenceDemoController
{
pulbic List<Lead> leadList{get;set:}
pulbic List<contact> conList{get;set:}
pulbic List<account> accList{get;set:}
public DeferenceDemoController()
{
}
publilc void soslDemo_method()
{
OptyList=new List<opportunity>();
leadList=new List<Lead>();
ConList=new List<Contact>();
accList=new List<account>();
List<List<SObject>> SearchList=[FIND ‘test’ IN ALL FIELDS RETURNING
ACCOUNT(Id,Name,type),
Contact(name,email),Opportunity(name,StageName), Lead(Company,name,Status)];
accList=((List<Account>)SearchList[0]);
conList=((List<Contact>)SearchList[1]);
OptyList=((List<Oppertunity>)SearchList[2]);
LeadList=((List<Lead>)SearchList[3]);
}
}
Vf Page:-
<apexpage controller=”DeferenceDemoController”>
<apex:form>
<apex:CommandButton value=”show records using SOSL” action=”{!soslDemo_method}”/>
<apex:pageBlock title=”Account”>
<apex:pageBlockTable value=”{!accList}” var=”acc”>
<apex:column value=”{!acc.name}”/>
<apex:column value=”{!acc.Type}”/>
</apex:pageBlockTable>
</apex:pageBlock>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 134
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

<apex”pageBlock title=”account”>
<apex:pageBlockTable value=”{!conList}” var=”con”>
<apex:column value=”{!con.name}”/>
<apex:column value=”{!con.email}”/>
</apex”pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title=”Leads”>
<apex:pageBlockTable value=”{!leadList}” var=”lead”>
<apex:Column value=”{!lead.name}”/>
<apex:column value=”{!lead.Company}”/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title=”Opportunity”>
<apex:pageBlockTable value=”{!optyList}” var=”opty”>
<apex:column value=”{!opty.name}”/>
<apex:column value=”{!opty.StageName}”/>
<apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Transaction Control : All requests are delimited by the trigger, class method, Web
Service, Visualforce page or anonymous block that executes the Apex code. Controling these
are done by transactional Control satatements

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 135
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Exception Statements : Apex uses exceptions to note errors and other events that disrupt
the normal flow of code execution. throw statements can be used to generate exceptions,
while try, catch, and finally can be used to gracefully recover from an exception.

Throw Statements : A throw statement allows you to signal that an error has
occurred. To throw an exception, use the throw statement and provide it with an exception
object to provide information about the specific error.

Try-Catch-Finally Statements

• The try statement identifies a block of code in which an exception can occur.
• The catch statement identifies a block of code that can handle a particular type of
exception. A single try statement can have multiple associated catch statements,
however, each catch statement must have a unique exception type.
• The finally statement optionally identifies a block of code that is guaranteed to
execute and allows you to clean up after the code enclosed in the try block. A single
try statement can have only one associated finally statement.

DML operations:

Apex enables you to insert, update, delete or restore data in the database. DML
operations allow you to modify records one at a time or in batches.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 136
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

The operations are INSERT


UPDATE
DELETE
UPSERT
There are two ways to perform DML operations.
1) By using DML statements
Eg: list <account>acclist = new list<account>();
Acclist.add (new account (name = ‘vedha1’));
Acclist.add (new account (name = ‘vedha2’));
Insert acclist;
2) By using database class
Eg: list <account>acclist = new list<account>();
Acclist.add (new account (name = ‘vedha1’));
Acclist.add (new account (name = ‘vedha2’));
Database.saveresult[] sr = database.insert (acclist, false);
There is one difference between above two operations. In the database class method you can specify whatever to
allow partial processing of the records if any errors are encountered.
By parsing the Boolean value as a parameters to database-Insert.
• If you give the parameter as true if any error occurs it doesn’t allow the operation to continue.
If you specify false the remaining DML operations can still succeed, where as insert in DML if any one of the
record fails the total operation is discarded.
Eg:-
Public pageReference show()
{
List<Account> acc=new List<Account>();
Account a1=new Account(name=’Today4’,industry=’Banking’);
Account a2=new Account(Industry=’Banking’);
Account a3=new Account(name=’Today4’,industry=’Banking’);
acc.add(a1);
acc.add(a2);
acc.add(a3);
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 137
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Database.SaveResult[] r=Database.insert(acc,true),
return null;
}
In the above program when we give database.insert (acc,true), if any error occurs in any one of the records
a1,a2,a3 the entire operation of insert is rolledback.
When you give database.insert (acc, false) for above statements, if any error occurs in any one of the records
a1,a2,a3 only that record is terminated and status is saved to save result calss rest of the operations are processed
normally.
Database.query locator class:
Database.query locator calss stores the record set return by the database.get query locator.
Methods:
There are two methods in query locator calss.
1) Gerquery():
Syn: public string gerquery()
This method returns the query used to instantiate the Database.query locator object.
This is very much useful when testing the start method.
Eg:Database.querylocatordq = Database.getquerylocator ([select name from account]);
String str = dq.getquery();
//str = ‘select name from account’;
2) Iterator():
Syn: public Database.querylocator Iterator iterator()
This will return new instrance of query locator iterable.
Eg:
List <account>acc = new list <account>();
Database.queryLocatordq = Database.getquerylocator();
Database.querylocatoriterableiq = dq.iterator();
While (iq.hasnext())
{
Account a = (account) iq.next();
Acc.add (a);
}
Locking Statements

Apex allows developers to lock sObject records while they are being updated in order to prevent
race conditions and other thread safety problems. While an sObject record is locked, no other
program or user is allowed to make updates.

Keywords FOR UPDATE after any inline SOQL statement

Eg :
Account [] accts = [SELECT Id FROM Account LIMIT 2 FOR UPDATE];
for (Account[] accts : [SELECT Id FROM Account
FOR UPDATE]) {
// Your code
}

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 138
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Transactional Control
Save point created during execution of any statement for possible roll back is called Transactional Controls

Account a = new Account(Name = 'xxx'); insert a;


System.assertEquals(null, [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
AccountNumber);
// Create a savepoint while AccountNumber is null
Savepoint sp = Database.setSavepoint();
// Change the account number
a.AccountNumber = '123';
update a;
System.assertEquals('123', [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
AccountNumber);
// Rollback to the previous null value
Database.rollback(sp);
System.assertEquals(null, [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
AccountNumber);

Exception Statements

Apex uses exceptions to note errors and other events that disrupt the normal flow of code
execution. throw statements can be used to generate exceptions, while try, catch, and finally
can be used to gracefully recover from an exception.

Throw Statements : A throw statement allows you to signal that an error has
occurred. To throw an exception, use the throw statement and provide it with an exception
object to provide information about the specific error.

Try-Catch-Finally Statements

• The try statement identifies a block of code in which an exception can occur.
• The catch statement identifies a block of code that can handle a particular type of
exception. A single try statement can have multiple associated catch statements,
however, each catch statement must have a unique exception type.
• The finally statement optionally identifies a block of code that is guaranteed to
execute and allows you to clean up after the code enclosed in the try block. A single
try statement can have only one associated finally statement.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 139
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Anonymous Blocks
An anonymous block is Apex code that does not get stored in the metadata, but that
can be compiled and executed using one of the following:

• Developer Console

• Force.com IDE

• The executeAnonymous Web services API call:

ExecuteAnonymousResult executeAnonymous(String code)

APEX Classes
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 under

Navigation : Setup | Develop | Apex Classes.

Apex Classes

Outer classes : Top-level classes

Inner classes : One level deep

Eg :

public class myOuterClass {

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 140
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

// Additional myOuterClass code here

class myInnerClass {
// myInnerClass code here

}
}

Private Class : The private access modifier declares that this class is only known locally, that
is, only by this section of code. This is the default access for inner classes—that is, if you don't
specify an access modifier for an inner class, it is considered private. This keyword can only
be used with inner classes.

Public Class : The public access modifier declares that this class is visible in your
application or namespace.

Global Class :The global access modifier declares that this class is known by all Apex code
everywhere.

The with sharing and without sharing keywords specify the sharing mode for this class.

The virtual definition modifier declares that this class allows extension and overrides. You
cannot override a method with the override keyword unless the class has been defined as
virtual.

The abstract definition modifier declares that this class contains abstract methods, that is,
methods that only have their signature declared and no body defined.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 141
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Class Construct
private | public | global |virtual | abstract | with sharing | without sharing | (none)]

class ClassName [implements InterfaceNameList | (none)] [extends ClassName | (none)]

// The body of the class

Keywords : Apex has the following keywords available:

final
instanceof
super
this
transient
with sharing and without sharing
OOPS

Object-oriented programming (OOP) is a programming paradigm using "objects" – usually


instances of a class – consisting of data fields and methods together with their interactions –
to design applications and computer programs.

Class : Class is the 1st OOPs concept .Class defines the characteristics of objects which
includes its attributes , fields properties and behavior.
Eg : Class Car : Sped, Colour, Number - Attribute/Characteristics
Accelerating , breaking , turning - behavior

Objects : An object is an instant of a class . In sales force Object is an Table.


Instance : Instance is the actual object created at runtime. The set of values of the attributes
of a particular object is called its state. The object consists of state and the behaviour that’s
defined in the object’s class.

Method : Also called as functions in some programming languages , methods defines the
behavior of particular objects .
Eg : turning() , breaking ()

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 142
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Inheritance
Passing of behavior from Parent to child class is called Inheritance

❑ Virtual class can only be Inherited.


❑ Extends key word used to Inherit class
❑ Private cannot be Inherited.
❑ Without access modifies cannot be inherited
❑ This. Used to refer Class Variable.
❑ Super. Used to refer parent class variable.

Virtual
❑ To create virtual class, we need to use virtual definition modifier.
❑ You can extend a class to provide more sophisticated behaviour.
❑ Class that extends another class inherits all the methods and properties of the
extended class.
❑ Methods declared as virtual can be override. In other words, overriding a virtual
method allows you to provide a different implementation for an existing method.
❑ A class can only extend one other class, but it can implement more than one interface.
❑ Virtual class can be initialize directly new TestVirtualClass();
❑ You can use only virtual methods.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 143
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

❑ Virtual class is some kind of “full” class. All methods are implemented, but can be
override by child class.

Polymorphism

Polymorphism is the ability of a Object (method) to behave differently at different places.


Type
❑ Overloading
❑ Overriding

Overloading : Overloading is when two or more methods of a class have the same name but
have different parameter lists. Also known as Compile time polymorphism (static binding)

Overriding : An override is a type of function which occurs in a class which inherits from
another class. An override function "replaces" a function inherited from the base class
Also known as Runtime polymorphism (dynamic binding)

❑ Method having same name in both Class (Parent and Child)


❑ Parent method should use Virtual.
❑ Child Method Should use override
❑ Super. Method() can be used only for Non Static Method

Abstraction

An abstract class that contains methods only have a signature and no body is defined.
Can also define methods.

❑ To create abstract class, we need to use abstract definition modifier.


❑ Allow to extend the child class.
❑ Abstract class can contain methods signed as abstract, to clarify, it is a method that
has only a signature (body is not defined).
❑ Child class must implement all methods declared as abstract!

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 144
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

❑ Abstract class can also include other methods, which have the logic. To allow child
class access those methods use protected or public keyword.
❑ Cannot be initialize directly: new TestAbstractClass():
❑ Abstract class can contain both virtual and abstract methods.
❑ Abstract class is some kind of “partial” class. Therefore, some methods are
implemented, some needs to be implemented by child class.
❑ virtual methods can be override, but this is not mandatory.
❑ We can have different signatures for our methods:
❑ private – child class doesn’t have access to method signed as private.
❑ protected – child class has access to parent class method, but any other class doesn’t
have access.
❑ public – In other words, making method accessible by any other class.

Encapsulation

It is an Object Oriented Programming concept, which binds the programming elements


together in a single unit that manipulate the data, and that keeps both safe from outside
interference and misuse.

Wrapping (or Binding) method and data together into a single unit is known as
encapsulation.

It is all about hiding the code to secure the contacts of a program. To hide the code we
enclose the members of a program under a container or wrapper as class.

Programming Elements : Data and Instructions together can be called as programming


elements.

In other words data encapsulation has led to one of the important concept of
information hiding mechanism.

Binding of Programming Elements : It’s simply stating that a piece of code should be
grouped together with the data and actions important to that code’s purpose.

Why to use Encapsulation :

a)Provides namespaces/unique names for application data and functionality making


Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 145
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

code more manageable e.g. in the old days when classes didn’t exist and all your code
would be lumped together you could only have one function called calculate(). With
classes you can group functionality into classes and not have to think up crazy and
creative names for your variables and methods e.g. Tax.calculate() and IQ.calculate().

b)Protecting data that is read-only or irrelevant to the consumer.

c)Control over how variables are managed e.g. validating input before assigning it to a
variable.

d)Code is easier to read, maintain and extend.

e)OOP is impossible without it!

Interface

Object containing only methods is called Interface

❑ To create interface we need to use interface keyword.


❑ Interface can provide a layer of abstraction to your code.
❑ Interface is an apex class that can contain only method signature, as a result, the body
of each method must be empty.
❑ An apex class that is using the interface must implement all methods listed in the
interface.
❑ Interface separates the specific method declaration from its implementation.
Therefore you can have different implementation for the same method. Concept
behind Interface is that you can change implementation without changing your whole
code. Consequently, method signature (return type, parameters) are always the same.
❑ Interface can be treated as a new data type. In Apex we have a few predefined
interfaces like String, Integer, Double, etc. In other words implementation of those
methods can be change (by Salesforce) without changes in our code – that’s the
power of interface! e.g.: String.isBlank(‘Test’); We know method signature
(public static Boolean isBlank(String inputString)), but we don’t know
implementation layer.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 146
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Controllers
Controllers provides access to the data that should be displayed in a page, and to modify
component behavior.

Types:
01.Standard Controller
02.Custom Controller
03.Extension Controller

Standard Controller

standard controller includes a getter method that returns the record specified by
the id query string parameter in the page URL. This method allows the associated page
markup to reference fields on the context record by using {!object} syntax
Custom Controller

A custom controller is an Apex class that implements all of the logic for a page without
leveraging a standard controller. Use custom controllers when you want your Visualforce
page to run entirely in system mode, which does not enforce the permissions and field-level
security of the current user.
Controller Extension

Controller extension in Salesforce is an Apex class containing a constructor that is used to


add or extend the functionalities of a Standard Controller or custom controller in Salesforce.
Extension controller is also used to leverage the functionality of another controller using
our own custom logic. Controller extensions in salesforce can be used without Standard
controller or custom controller.

public class ExtentionEg


{
Public Account A ;
Public ExtentionEg(Apexpages.StandardController con)
{
A = (Account) con.getRecord();
}
}

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 147
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

PageReference Class

A PageReference is a reference to an instantiation of a page. Among other attributes,


PageReferences consist of a URL and a set of query parameter names and values.

▪ Use a PageReference object:To view or set query string parameters and values for a
page
▪ To navigate the user to a different page as the result of an action method

Eg:
• PageReference pageRef = new PageReference(‘/’+Accountid);

• PageReference pageRef = new PageReference('http://www.google.com');

• PageReference pageRef = ApexPages.currentPage();

public class MyController


{
public Account getAccount()
{
return [SELECT Id, Name FROM Account WHERE Id =
:ApexPages.currentPage().getParameters().get('Id')];
}
}
Annotations

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.

Apex supports the following annotations:

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 148
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Testing Apex : Testing is the key to successful long term development, and is a critical
component of the development process. 75% of your Apex code must be covered by unit
tests, and all of those tests must complete successfully.
Format : @isTest

Dynamic Apex : Dynamic Apex describes features of Apex that bypass its typically strongly
typed nature. For example, database queries, objects, and fields are part of the language,
and references to them are strongly typed, validated at compile time. Dynamic Apex allows
you to work with these objects as ordinary strings rather than compiled parts of your
program. This has its advantages in that your program can be more dynamic and generic.

Dynamic SOQL refers to the creation of a SOQL string at runtime with Apex code. Dynamic
SOQL enables you to create more flexible applications. For example, you can create a search
based on input from an end user, or update records with varying field names.

Dynamic SOSL refers to the creation of a SOSL string at runtime with Apex code. Dynamic
SOSL enables you to create more flexible applications. For example, you can create a search
based on input from an end user, or update records with varying field names.

Dynamic DML In addition to querying describe information and building SOQL queries at
runtime, you can also create sObjects dynamically, and insert them into the database using
DML.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 149
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Constructor

Constructor in Apex Programming is a code and is a special method that is invoked when an
object is created from the class.

1. Method name will be same as Class.


2. Access specifier will be public.
3. This method will invoked only one that is at the time of creating an object.
4. This is used to instantiate the data members of the class.
5. Constructors don’t have return type
6. A constructor is automatically called when an object is created.

Type of Constructor

1. Default Constructor.
2. Non-parameterized Constructor.
3. Parameterized Constructor.

Constructor VS Method

❑ Constructor are used to initialize the state of object,where as method is expose the
behavior of object.
❑ Constructor must not have return type where as method must have return type.
❑ Constructor name same as the class name where as method may or may not the same
class name.
❑ Constructor invoke implicitly where as method invoke explicitly.
❑ Constructor compiler provide default constructor where as method compiler does't
provide.

Asynchronous Services

Batch Apex

• For long-running jobs with large data volumes that need to be performed in batches,
such as database maintenance jobs
• For jobs that need larger query results than regular transactions allow

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 150
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Scheduled Apex

• To schedule an Apex class to run on a specific schedule

Queueable Apex

• To start a long-running operation and get an ID for it


• To pass complex types to a job
• To chain jobs

Future Methods

• When you have a long-running method and need to prevent delaying an Apex
transaction
• When you make callouts to external Web services
• To segregate DML operations and bypass the mixed save DML error

Asynchronous vs Synchronous
Asynchronous
• Actions that will not block the transaction or Process
• Duration is not priority
• Higher Governor limits
Synchronous
• Quick and Immediate actions
• Transactions are immediate and serial
• Normal Governor Limits

Batch apex:
Batch apex allows you to define a single job that can be broken up into manageable chunks, where every chunk
can be processed separately.
Eg:
If you need to make a field update of every record of account object in your organization, then we have governing
limits that would restrict us from achieving the above task.
Reasion:
In a single transaction we can process only 10,000 records. Now, in the above case if we have more than 10,000
records in the organization then we can not perform this field update.
Batch apex: in the batch apex it will fetch all the records on which you want to perform the field update and
divide theminto list of 200 records and on every 200 records operation is performed separately.
• This would help us to execute on more than 10,000 records as it wont perform an opration on all the
records in a single transaction instead it dividing them into no. of subtsks where each subtask may contain
the records upto 2,000.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 151
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Database.Batchable interface:
To use the BatchApex concept the apex class should implement database.Batchable interface.
• Database.Batchable interface consists of 3 methods that msut be implemented.
1) Start method
2) Execute method
3) Finish method

1) Start method:
Start method is automatically called at the beginning of the batch apex job.
• This method will collect the records or objects on which the operartion should be performed.
• This records are broken down into subtasks and given to execute method.
Syntax:
Global (Database.QueryLocator/Iterable<SObject>)
Start (Database.Batchable context bc) {}
• The return type of the start method can be
i) Database.QueryLocator
Or
ii) Iterable<SObject>
i) Database.QueryLocator:
Use Database.QueryLocator as return type to the start method when you are fetching the records using
a simple select quiery.
Note: the governing limit says
i) Total number of records retrieved by SOQL Queries 50,000
ii) Total number of records retrieved by Database.getQueryLocator 10,000
But in the Batch apex the governing limits for SOQL query are bypassed and we can fetch upto 50 millon
records using Database.QueryLocator.
Eg:
Global Database.QueryLocator start (Database.batchablecontextbc)
{
Return Database.QueryLocator (‘select id, name from account’);
}
Eg2: Write a start method to fetch all customer name, account tupe from customer object whose accountype is
‘saving’.
Global Database.queryLocator start (Database.Batchable context bc)
{
String sql = ‘select id, customer_name__c, account_type__c from customer__cwheeaccount_type__c =
‘+’ \ ‘saving\’;
}
ii) iterable: use iterable as a return type when you want to use complex logic or scope to fetch the records for the
batch job.
Eg: global class Mytest implements iterable<account>
{
}
Global iterable<account> start (Database.batchable context bc)
{

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 152
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Return new Mytest(); //this should return object of the class that has implemented iterable
interface.
}
2) execute method:
The records which are fetched from the start method are divided into batches of 200 records each. Now every
batch of 200 records are separately pass to the execute method separately and the operation what we want to
perform on these records are written in this execute method.
Syntax:
Global void execute (Database.batchablecontextbc, List<p>) {}
This method takes two parameters
• A reference to the Database.Batchable context object.
• A list of SOjects such as List <SObject>, or a list of parameterizd types.
i.e., set of 200 records which are passed to the execute method are stored in this list.
3) finish method:
When the start method has fetched 1000 records on which we want to perform the operations they are divided into
5 batches/groups of size 200.
• On every batch or the group the execute method is called
• Which means execute method is called 5 times.
• After executing every group/batch the governing limts are reset for the execute method.
• Once all batches are executed then finish method will be called to send email notification or for post
exection word.
Syntax:
Global void finish (Database.Batchable context bc) {}
Note: all the 3 methods of the Batchable interface refers to Database.Batchable context object where this
object is used to track the progress of the batch job.
Database.stateful:
Each execution of batch apex job is considered as discrete transaction which means when you have a batch job
with 1000 records executed with optional scope of 200 records then
Batch1 -------→ 1 – 200
Batch1 -------→ 201 - 400
Batch1 -------→ 400 – 600
When we call execute on batch1 to summarize the value
Integer sum = 0;
Public void execute (Database.Batchablecontextbc, List <account> scope)
{
For (account a:scope)
}
• First batch of 1-200 records call the execute method : with 200 records
Before calling execute() : sum = 0
After calling execute() : sum =30000 (assume it)
• When the execute () Is called on batch 2 of records 201-400 then intial value of sum again set to zero.
Before calling execute() on batch1 : 1-200 records : sum = 0;
After calling execute() on batch1 : 1-200 records : sum =30000
Before calling execute() on batch2 : 201-400 records : sum = 30000;
When we call execute () on batch2:201-400 records

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 153
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

First sum is set = 0 again sum = 0 then again fresh summary value is calculated again.
• Which means the state of the batch is forwarded from one execute () to another execute().
• If you specify Database.stateful in the class definition, you can maintain state across these transactions.
This is useful for counting or summarizing records as they are processed.
For eg: suppose your job processed opportunity records you could define a method in execute to aggregate
Totals of the opportunity amounts as they were processed.
Global class summarize account total implements Database.batchable<SObject>, Database.stateful
{
Global final string query;
Global integer summary;
Global summarize accounttotal (string q)
{
Query = q;
Summary = 0;
}
Global Database.querylocator start (Database.batchablecontextbc)
{
Return Databaxe.getqueryLocator (query);
}
Global void execute (Database.batchable context bc, List <SObject> scope)
{
For (SObject s:scope)
{
Summary = Integer.value of (s.get(total__c’)) + summary;
}
}
Global void finish (Database.BatchableContextbc)
{
}
}
Governing limits:
1) Only one batch apex jobs start method can run at a time in an organization.
2) Upto 5 queued or active batch jobs are allowed for apex.
3) The maximum numbers of batch apex method executions per a 24-hour period is 2,50,000
4) The batch apex start method can have up to 15 query cursors open at a time per user.
5) A maximum of 50 million records can be returned in the Database.QueryLocator object.
6) The start, execute and finish methods can implement up to 10 callouts each.
Note: if we have 1000 records with scope of 200 records then they are divided into 5 batches.
So execute() method is called 5 times which means in every execute() we call 10 callouts. So in this scenario we
call
Start() ------→ 10 callouts
Execute () ------→ 10*5 = 50 callouts
Finish() ------→ 10 callouts
-------------------
70 callouts in entire operations
Limitations:

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 154
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• Method declared as future aren’t allowed in the classes that implement Database.Batchable interface.
• Methods declared as future cant be called from batch Apex class.
• For sharing re calculation, we recommend that the execute method delete and then re-create all Apex
managed sharing for the records in the batch.
• For each 10,000 asynchapex job records, apex creates one additional asynapexJob record of type
BatchApex worker for internal use.

Apex scheduler
It wil invokes the Apex class to run at specific time.Anybody who want to schedule their class they have to
implement schedulable interface.
Schedulable interface:
The class that implements this interface can be scheduled to run at different intervals.This interface has several
methods they are public void execute(Schedulable context SC)
Eg:Public class My schedule implements schedulable
{
Account a = new account (Name = ‘Faraz’);
Insert a;
}
• The sechdular will run in sustemcontext, which means all the classes are executed wheather the user has
permission or not.
• We can monitor or stop the execution of scheduled apex
Job using Salesforce user interface from setup.
Navigation:
Setup ---→ Monitoring ---→ jobs ---→ Scheduled jobs
• The execute() method must be declared as public or global.
• Using system schedule.
System.schedule:
Once you are implemented schedulable interface use system.schedulable method to execute the class.
System.schedule () method takes 3 parameters.
1) Name of the job.
2) Expression that is used to represent time and date of the operation.
3) The object of the class which you want to execute.\
Expression is written in the form of ‘seconds, minutes, hours, day of the month, month day of the week, optional
year’.
‘seconds min hours day_month month day_week optional year’
0-60 0-60 0-24 1-31 1-12 1-7

Special characters:
?: specifies no specific value this is only available for day of the month and day of the week.
Eg: write the expression to schedule an operation 10th of August at 12:30 pm.
Ans: ‘0 30 12 10 8 ?’
‘0 30 12 10 aug ?’

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 155
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

‘0 30 12 10 aug ? 2013’
Eg: write an expression to schedule an operation on Jan Monday 12:30.
Ans: ‘0 30 12 ? 1 Mon’
‘0 30 12 ? 1 2’
*: spedifies all the values.
Eg: write the expression to schedule an operation on everyday of the Aug at 12:30 pm.
‘0 30 12 * Aug ?’
‘0 30 12 * 8 ?’
Eg: expression to schedule on every hour on 10th Aug.
‘0 30 12 * 8 ?’
L: specifies the end of the range. This is available only day of the month or day of the week.
Eg: write an expression to schedule the operation on last Friday of the March at 10:20.
‘0 20 10 ?3 6L’
W:spedifies nearest weekday of the given day. This is available for only day of the month.
Eg: if we specifies 20W and 20th is a Saturday so the class runs on 19th. If I give 1W and 1st a Saturday then it
runs on Monday not on previous month.
Eg: write an expression to schedule an operation on nearest weekday of March 20th at 10:20.
‘0 20 10 20W 3 6L’
This is to specify the last working day of last week day of last of month.
#: this specifies nth day of the month.
Week_day # Day_Month
2#2 it will run Monday of every 2nd month.
,: Jan,Mar means Jan-Mar.
• If you want to schedule any operation we have to create an object for the class which has implemented for
schedulable interface.
Class MySchedule implements schedulavle
{
Public void execute (schedulable context sc)
{
}
}
MySchedule my = new MySchedule();
String str = ‘0 0 10 * 3 2’;
System.schedule (‘Myjob’, str, my);

Name Time Object


Format
System.schedulebatch():
System.scheduleBatch() is used to run a schedule a batch job only once for a future time. This method has
got a 3 parameters.
Param1: instance of a class that implements Database.Batchableinterace.
Param2: Job name
Param3: Time interval after which the job should start execute.
Param4:its an optional parameter which will defines the no. of processed at a time.
The system.SecheduleBatch() returns the scheduled job Id (cronTriggerid).
• We can use this job id to abort the job.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 156
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Example: You have to first implement the schedulable interface for the class the specify the schedule using
schedule apex page or system.schedule method.
Apex class:
Global class purge implements schedulable
{
Global vlid execute (schedulablecontextsc)
{
List <creditcard = new List <credit_card__c>();
For (credit_card__c cc:[select Id, Name from credit_card__c where Age_c>2])
{
Creditcard.add(cc);
cc.cw__c = ‘0000’;
}
Database.update (creditcard);
}
}
Eg: if we want to schedule
i) Create an object for the calss which has implemented the scheduable interface.
ii) Create the time frame.
iii) Invoke the system.schedule method with job name, schedule object, time frame.

Global class MyBatch implements Database.Batchable<SObject>


{
Global Database.QueryLocator start (Database.Batchablecontextbc)
{
Return Database.getqueryLocator (‘select Id, name from Account’);
}
Golbla void execute (Database.Batchable context bc, List <SObject> scope)
{
List <Account>acc = new List <Account> ();
For (SObject x:scope)
{
Account a = (Account) x;
a.name = ‘Mb’ + a.name;
acc.add (a);
}
Update acc;
}
Global void finish (Database.Batchable context bc)
{
}
}
ii) global class MySchedule implements schedulable
{
Global void execute (schedulablecontextsc)
{
MyBatchmb = new MyBatch();

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 157
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Database.execute (mb);
}
}
ii) global class textschedule
{
Public page reference show()
{
String timeframe = ‘0 10 8 10 * ?’;
Myschedulems = new MuSchedule ();
System.schedule (‘Myjob’, timeframe, ms);
}
}
Vf page:
<apex:page controller = ‘Textschedule’>
<apex:form>
<apex:commandButton value = “click” action + “{!show}”/>
</apex: form>
</apex:page>
Schedulable Apex limitations:
• We can schedule only 100 jobs at a time
• Max no. of apex schedule jobs in 24 hours is 2,50,000 no. of jobs.
• Synchronous web service callouts are not supported in schedulable Apex.

Future Apex(@future)

Future methods are used to run the process in a separate thread, at later time when system
resources are available. We can use future methods for any operation we would like to run
asynchronously in its own thread.

Use the future annotation to identify methods that are executed asynchronously. When you
specify future, the method executes when Salesforce has available resources.

❑ Methods with the future annotation must be static methods, and can only return a void
type.
❑ The specified parameters must be primitive data types, arrays of primitive data types, or
collections of primitive data types.
❑ Methods with the future annotation cannot take sObjects or objects as arguments.
❑ Methods with the future annotation cannot be used in Visualforce controllers in
either getMethodName or setMethodName methods, nor in the constructor.
❑ You cannot call a method annotated with future from a method that also has
the future annotation.
❑ A future method runs in the background, asynchronously.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 158
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Future annotation:- (@future):-


1. Use the future annotation to specify that these methods that are executed asynchronously.

2. Methods with future annotation must be static methods

3. Methods with future annotationcan only return a void type.

4. @future(callout=true),this indicates that this future methods can use callouts.

Eg:- @future(callout=true)
Public static void docalloutfromFuture()
{
//Add code to perform callout
}
5. @future(callout=false)ths is used to prevent a method from making callouts.

6. The Parameters specified must be premitive datatypes,arrays of premitive datatypes or collectios of


premitive datatypes.

7. Methods with the future annotation can not take Sobjects or objects as arguments.

IMP:- How to pass Sobjects/Apex class object as parameters in the @future methods.

Step 1:- First create Apex class Address.


public with sharing class Address
{
public string street{set;get;}
public string city{set;get;}
public String state{set;get’;}
public Stringip{set;get;}
public Adderss(String s,String c,String st,String z)
{
Street=s;
City=c;
State=st;
Zip=z;
}
}
Step 2:- Create Address Future class
1. With in the constructor create object for Address class and serialize the objects.

2. Create a future method callfuture(String)with String as parameter in the method deserialize the string to
objects and use them.

public with sharing class AddressFuture


{

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 159
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

public addressFuture()
{
List<String>address=new List<String>();
AddressHelper ah1=new AddressHelper(‘1 here st’,’sanfransisco’,’CA’,’94105’);
AddressHelper ah2=new AddressHelper(‘2 here st’,’sanfransisco’,’CA’,’94105’);
AddressHelper ah3=new AddressHelper(‘3 here st’,’sanfransisco’,’CA’,’94105’);
//serialize my objects ah1,ah2,ah3
Addresser.add(JSON.serialize(ah3));
Addresser.add(JSON.serialize(ah2));
Addresser.add(JSON.serialize(ah3));
Callfuture9addresser);//invoke the future method bypassing a string address where it a serialized form
of Apex class objects.
}
@future
Static void callfuture(List<string>addresserser)
{
Address currAddress=null;
For(String ser.addresserser)
}
currAddress=(address)JSON.deserialize(ser,AddressHelper.class)l
Syatem.debug(‘Deserialized in future:’+currentaddress.street);
}
}
}
NOTE:-
➔ No more than 10 method calls per apex invocation.

➔ You cannot call a method annotated with future from a method that also has the future annotation, nor
you can call trigger from an annotated method that calls another annotated method.

➔ All asynchronous calls made after the startTest method are collected by the system. When StopTest is
executed, all asynchronous processes run synchronously.

Queueable Apex

This interface enables you to add jobs to the queue and monitor them and execute asynchronous
Apex processes by using the Queueable interface .

Queueable jobs are similar to future methods in that they’re both queued for execution, but they
provide you with these additional benefits.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 160
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• Getting an ID for your job: When you submit your job by invoking
the System.enqueueJob method, the method returns the ID of the new job.
• Using non-primitive types: Your queueable class can contain member variables of non-
primitive data types, such as sObjects or custom Apex types. Those objects can be
accessed when the job executes.
• Chaining jobs: You can chain one job to another job by starting a second job from a
running job. Chaining jobs is useful if your process depends on another process to have run
first.
Eg:

public class AsyncExecutionExample implements Queueable


{
public void execute(QueueableContext context)
{
}
}
ID jobID = System.enqueueJob(new AsyncExecutionExample());

Asynchronous Call

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 161
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Testing:
• If you want to validate whether the application what we have created is working as expected.
• There are two ways of testing an application.
1) Using Salesforce user interface.
2) Testing bulk functionality (upto 200 records can be passes through your code)
• Before you deploy your code or package to the force.com App exchange the following conditions should
be satisfied.
i) Atleast 75% of your Apex code must be covered by unit text.
ii) All the test cases will be successful.
Note: When you deploy any code production will be executed Test methods and the test classes are not part of
Apex code coverage
• Every trigger must have some test case.
• All classes & triggers should compile successfully.
What are the factors that need to be tested in Apex programming:
1) Single Action: this is to test a single record, produces the correct expected result.
2) Bulk actions: any Apex code, whether a trigger, a class or an extension, may be invoked for 1 to 200
records. You must test not only the single record case, but bulk cases as well.
3) Positive behavour: Test to verify that the expected behavior occurs through every expected permutation,
that is, that the user filled out every thing correctly and did not go past the limits.
4) Negative behavior: there are likely limits to your applications, such as not being able to add a future date,
not being able to specify a negative amount & soon.
5) Restricted user
Apex unit test:
• Unit test are the class methods that verify whether a particular piece of code is working properly or not.
• Unit test method takes no arguments & commits no data to the database will not send any emails.
Test method keyword:
• When you want to create a test method should be prefixed with keyword test method.
• All the test methods are static.
Eg: Public class myclass
{
Static testMethod void myTest()
{
//Add test method logic using system.assert(), system.assert Equals()
//and system.assertNotEquals () here
}
}
Note: Test methods can not be defined in Apex trigger.
@isTest Annotation:
If you define any method as @isTest then the method is test method just like what we have defined.
• If any class is defined with annotation @isTest then that class is defined as test class.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 162
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Eg1: @isTest
Private class myclass
{
Static testmethodvoid.mytest()
{
//code_block
}
}
This is the same test class as in previous example but it defines the test method with the isTest annotation
instead.
Eg: @isTest
Private class myclass
{
@isTest Static void mytest()
{
//code_block
}
}
Note: class defined with the isTest annotation don’t count against organization limit of 3 mb for all apex code.
Eg3:
@isTest
Private class MyTestclass
{
//Method for testing
@isTest static void test1()
{
//implement test code
}
@isTest static void test2()
{
//implement test code
}
}
• Test classes must be defined as isTest with access specifier as public/private.
• By default access level is private.
• Method of the test class can be called only from the running method.
A test method can not be invoked in non-test method.
Eg:-
Apex Class(TV Remote Control):-
public class TvRemoteControl
{
//volume to be modified
Integer volume
//constant for maximum volume value
Static final Integer MAX_VOLUME=50;
//constructor
public TvRemoteControl(Integer V)

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 163
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

{
//set initial value for volume
Volume=11;
}
public Integer increase Volume(Integer amount)
{
Volume t=amount;
If(Volume>MAX_volume)
{
Volume=MAX_VOLUME;
}
return volume;
}
public Integer decreaseVolume(Integer amount)
{
Volume=amount;
If(volume<0)
{
Volume=0;
}
return volume;
}
public Static String getMenuOptions()
{
return ‘AUDIO SETTING-VIDEO SETTINGS’;
}
}
Test Class:- (TvRemoteControlTest):-
@isTest
Class TvRemoteControlTest
{
@isTest static void testvolumeIncrease()
{
TvRemoteControl rc=new TvRemoteControl(10);
Integer newVolume=rc.increaseVolume(15);
System.assertEquals(25,newVolume);
}
@isTest Static void testvolumeDecrease()
{
TvRemoteControl rc=new TvRemoteControl(20);
Integer newvolume=rc.decreasevolume(15);
System.assertEquals(5,newvolume);
}
@isTest Static void testvolumeDecreaseUnderMin()
{
TvRemoteControl rc=new TvRemoteControl(10);
Integer newvolume=rc.decreasevolume(100);
System.assertEquals(0,newVolume);

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 164
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

}
@isTest Static void testGetMenuOptions()
{
//Static method call.No record to create a class instance
String menu=TvRemoteControl.getMenuOptions();
System.assertNotEquals(null,menu);
System.assertNotEquals(‘ ‘,menu);
}
}
NOTE:- From API 28.0 test methods no longer be reside in the non-test class.

Accessing private members of the class in test class:


• Private members of the class cant be accessed outside the class. This will create a problem in checking
private members.
• If you want to check the private members of the class add annotation @Testvisible to before the
private/protected members of the class.
• When you keep the annotation @Testvisible before the private members those are visible with in a test
class.
Eg:
Apex class (visible sample class):
Public class visible sampleclass
{
//private members variables
@Testvisible private integer recordNumber = 0;
@Testvisible private string areacode = ‘(415)’;
//public member variables
Public integer maxrecords = 1000;
//private inner class
@Testvisible class employee
{
String fullName;
String phone;
//constructor
@Testvisible Employee(String s,String ph)
{
Fullname=s;
Phone=ph;
}
}
//private methos
@Testvisible private String privateMethod(Employee e)
{
System.debug(‘I am Private’);
recordNumber++;
String phone=areacode+’ ‘+e.phone;
String s=e.fullName+’\’s phone number is ‘+phone;
System.debug(s);
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 165
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Return s;
}
//public method
Public void publicMethod()
{
maxRecords++;
System.debug(‘I amvisible’);
}
@Testvisible private class MyException extends visibleSampleclass()
}
Testclass(visible sampleclass Test):-
//Test class for visible sample class
@isTest
Private class visibleSampleclassTest
{
//this test method can access private members of another class that are annotatedwith @testvisible
Static testmethod void test1()
{
visibleSampleclass sample=new visibleSampleclass();
//Access private innerclass
visibleSampleclass.Employee emp-new visibleSampleclass Employee(‘Joesmith’, ‘555-1212’);
//callprivate method
String s=Sample.privatemethod(emp);
//verify result
System.assert(
s.contains(‘(510)’)&&
s.contains(‘joeSmith’)&&
s.contains(‘555-1212’));
}
Static testmethod void test2()
{
Try
{
Throw new visibleSampleClass.myException(‘Thrown from a test’);
}
Catch(visibleSampleclass.MyException e)
{
//Handle Exception
}
}
Static testmethod void test3()
{
//Access public method
//No @testVisible is used
VisibleSampleClass Sample=new visibleSampleClass();
Sample.publicMethod();
}
}

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 166
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Triggers
Triggers is a Apex code that executes before or after the following types of DML Operations.
* insert
* Update
* Delete
* Merge
* Upsert
* Undelete
Triggers are divided into two types.
1) Before Trigges
2) After Triggers
1) Before Trigges:-
Before triggers can be used to update o validate values of a record before they are used to the
database.
2) After Triggers:-
After Triggers can be used to access field values of the records that are stored in the database and use
this values to make change in others records.
Syntax:-
trigger triggername on objectname(trigger_events)
{
code_block
}
Where trigger_events can be comma seperated list of events.
Types of events in the triggers:-
1) Before insert
2) Before Update
3) Before Delete
4) After insert
5) After update
6) After delete
7) After undelete
Eg:-
trigger Sample on Account(before insert,after delete)
{
//code block
}
NOTE:- Triggers can only contains keywords applicble to an inner class.
-----> You do not have to commit the data manually,it automatically saves into dtabase.
Trigger.New:-
Trigger.New is a content variable which contains list of records which has caused the triggers to fire.
--------> Triggers.New can be used in the trigger events.
1. Before insert
2. Before update

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 167
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

3. After insert
4. After update
5. After undelete
NOTE:- There is no concept called Triggers.New in delete Operations.
Create a table Customers:
CID Name Age Phone
111 aaa 23 1234
222 bbb 34 3455
333 ccc 45 9876

Trigger.New in before insert:-


We have an object with three records.
CID Name Age Phone
111 aaa 23 1234
222 bbb 34 3455
333 ccc 45 9876

In this object if we are trying to insert,new records,into customer object.


444 ddd 34 1234
555 eee 23 3456

Then the new records which we are trying to insert are stored in Triggers.New in before insert event.which
means
List<customer__c> cus=Trigger.New;
444 ddd 34 1234
555 eee 23 3456

These records are stroed into Trigger.New

NOTE:- The records which are stored in the Trigger.New we can directly perform changes in before insert.
Eg:- for(customer__C c:Trigger.New)
{
c.Age__c=30;
}
NOTE:- Before insert event will occur before new records are inserted into the database. So we can not retrieve
the new records using DML operations in before trigger.
i.e,
When we have customer table with following records.
CID Name Age Phone

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 168
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

111 aaa 23 1234


222 bbb 34 3455
333 ccc 45 9876

When we are trying to perform insert these two new records


444 ddd 34 1234
555 eee 23 3456

If there is any before insert trigger and we have written any DML in it.
trigger example on customer__c(before trigger)
{
List<customer__C> my=[Select cid__c, Name, Age__C, phone__C from customer__c];
//this query will only fetch three records
111 aaa 23 1234
222 bbb 34 3455
333 ccc 45 9876

as remaining two records are not yet inserted.


}
Before Insert:-
Theese triggers will fire when we are trying to insert a new records into a specified object.
----->Operations which we have written in triggers will be implemented before new records are called to the
dtabase.
------> In before insert, Trigger.New stores the list of new records which we are trying to insert.
Before Insert:-
These triggers will be fired when we are trying to insert a new records into a specified object.
-------> Opearations which we have written in triggers will be implemented before new records are saed to the
database.
-------> In before insert,Trigger.New Stores the list of new records which we are trying to insert.
Scenario1:-
When we are trying to insert new record into object. If there is any record exisiting with same account name it
should prevent duplicate record.
trigger accountinsert on Account(before insert)
{
for(Account a:Trigger.New)
{
List<Account> mynew=[select id,Name from Account where name=:a.name];
if(mynew.size()>0)
{
a.Name.addError('Account with name is exisisting');
}

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 169
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

}
}

TestCase:-
@isTest
public class AccountInsert
{
public static testMethod void testinsert()
{
String addError;
String myname='madhuri';
Account a2=new Account(name=myname);
List<Account> x=[select name from Account where name=: myname];
is(x.size()<1)
{
System.assertEquals(0,x.size());
insert a2;
}
else
{
addErrors='Exisisiting';
}
System.assertEquals('Exisisting', addError);
}
}
}
After insert:-
-----> this trigger will be fired after new records are successfully saved to the database.
-----> We can use Trigger.New to refer to the list of new records which we have inserted.
-----> on Trigger.New we can only perform read only operations.
-----> on the new list of records we can perform DML operations.
NOTE:- on any records that are successfully saved to database. If we want to perform any changes on those
records we have perform DML operations.
Eg:-
CID Name Age Phone
111 aaa 23 1234
222 bbb 34 3455
333 ccc 45 9876

When we insert a new records

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 170
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

444 ddd 32 3456


555 eee 56 7655

After triggers will be performed after commiting the new records into database which means
CID Name Age Phone
111 aaa 23 1234
222 bbb 34 3455
333 ccc 45 9876
444 ddd 32 3456
555 eee 56 7655

After Saving this records then after insert trigger will be called,so operation written in trigger will be performed
after records are successfully inserted.
Update events in Salesforce:-
There are two update events.
1. Before update
2. After update
Trigger.old and Trigger.New are in update events in salesforce.
----> we have a customer object with the following records
customer
111 aaa 23 3455
222 bbb 34 2344
333 ccc 45 9876

444 ddd 56 2346

In the above table when we are trying to update the records.


333 ccc 27 9876 to 333 ccc 49 7654
444 ddd 78 2346 to 444 ddd 35 1234
Trigger.New:-
Trigger.New will store the set of records on which new values on which you are performing update.
i.e,Trigger.New will have
333 ccc 49 7654 These two are records will store into Trigger.New
444 ddd 35 1234
Trigger.old:-
Trigger.old will store the set of records on which we are performing update. This store the records with old
values.
i.e, in the above case Trigger.old will have
333 ccc 27 9876

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 171
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

444 ddd 78 2346


Event:Before update:-
When ever we have trying to update any records in the object the operations which need to be
performed before saving the changes to database are written in before update.
Eg:-
Customer:-
CID Name Age Phone
111 aaa 23 3455
222 bbb 34 2344
333 ccc 45 9876
444 ddd 56 2346

Step 1:-
Update these records Step 2:-
333 ccc 29 7654 Before update operations
444 ddd 35 1234 are performed
Step 3:-
111 aaa 23 3455
222 bbb 34 2344
333 ccc 45 7654
444 ddd 56 1234
Pg No:248
-------> When we modify the value of a record and click on update
-------> Before trigger will be called on object and all the operation written it will be performed.
-------> Records are updated with new values in the database.
NOTE:- IF we want to make any changes in the values of new record we can directly perform using Trigger.New
in before trigger.
---------> we can not perform any changes in the records that are in Trigger.New using DML operations as they
are not at commited in the updated.
After Update:-
The operatios written in the afterupdate trigger will be fired when the changes that we have done are saved to
the database.
Eg:- Customer:
CID Name Age Phone
111 aaa 23 3455
222 bbb 34 2344 Step:-
333 ccc 45 9876 Update these records 333 ccc 29 7654
444 ddd 56 2346 444 ddd 35 1234

CID Name Age Phone


111 aaa 23 3455
222 bbb 34 2344 Operations written in after update perform now on new set of

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 172
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

333 ccc 29 7654 data.


444 ddd 35 1234
----> When we make some changes on the records on the object and click on update
------> Fiesr Before Trigger operations are performed on the object.
-----> All completing before update operations all values in Trigger.New are update to object.
-----> once records Trigger.New are updated to object then After Trigger operations are performed.
NOTE:- In the after update trigger operation we can only read the data from trigger.
-------> If we want to perform any changes on the records in after update trigger we have to write DML
Statements.
Page no: 250
Scenario1:-
When ever customer record is update,before updating the record create new record in test object with old
values of customer record.
Trigger:-
Trigger customerupdate on customer__c(before update)
{
List<Test__c>test=new List<Test__c>c);
For(customer__c x:Trigger.old)
{
Test__c t=new Test__c();
t.name=x:name;
t.salary__c=x.salary__c;
t.phone__c=x.phone__c;
test.add(t);
}
Insert test;
}
TestCase:-
@isTest
Public class insertcustomer
{
Static testMethod void testcustomer()
{
Customer__c x=new customer__c();
x.name=’satya’;
x.salary__c=1000;
x.phone__c=’123’;
insert x;
Test__c t=new Test__c();
t.name=x.name;
t.phone__c=x.phone__c;
t.salary__c=x.salary__c;
insert t;
System.assertEquals(t.name,x.name);
System.assertEquals(t.salary__c,x.salary__c);

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 173
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

x.name=’satys k’;
x.salary__c=30000;
update x;
}
}
Recursive triggers:-
→ You want to write a trigger that create a new record as part of its processing logic.However,that record many
then cause another trigger to fire,which inturn causes another to fire, and so on.You don’t know how to stop
that recursion.
➔ Use a static variable in an apex class to avoid an infinite loop. Static variables are local to the content of a
web request cor test method during a call to runTests()), so all triggers that fire as a result of a users
action have access to it.

Scenario 1:-
Suppose there is a scenario where in one trigger perform update operation,which results in invocation of second
trigger and the update operation in second trigger acts as triggering criteria fortriggerone.
Class:-
Public class utility
{
Public static boolean isFutureUpdate;
}
Trigger:-
Trigger updateSomething on Account(after insert,afterupdate)
{
/* this trigger performs its logic its when the call is not from @future */
If(utility.isFutureupdate!=true)
{
Set<Id> idsToprocess=new set<Id>();
For(Account acct:trigger.new)
{
If(acct.NumberOfEmployees>500)
{
idsToProcess.add(acct.Id);
}
}
/* sending ids to @future method for processing */
futureMethods.ProcesslargeAccount(idsToProcess);
}
}
Class:-

Public class FutureMethods


{
@future
Public static void processLargeAccounts(set<Id>accIDs)
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 174
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

{
List<Account> acctsToUpdate=new List<Account>();
/* isFutureUpdate is set to true to avoid recursion */
Utility.isFutureUpdate=true;
Update acctsToUpdate;
}
}
Scenario 2:- Recursion trigger erroe.
To explain about recursive trigger.
Trigger Recursive on Account(after insert,after update)
{
If(Trigger.isBefore && trigger.isInsert)
{
Account acc=[select id,Name from Account where name=’madhuri’ limit1];
Acc.name=’Y madhuri’;
Update acc;
}
If(Trigger.isAfter && Trigger.isupdate)
{
Account a=new Account(name=’satish’);
Insert a;
}
➔ The above trigger would generate Recursive trigger error as when you try to update one account record
it will call after update trigger on Account object,which would insert new record into account object.
Which inturn again call After update trigger on Account object.this would continue recursively.

To avoid Recursive trigger error we will use static variable


Global class Triggervar
{
Global static boolean flag=false;
}
Trigger:-
Trigger Recursive on Account(after insert,after update)
{
if(TriggerVar.flag1=true)
{
if(Trigger.isBefore && Trigger.isInsert)
{
TriggerVar.flag=true;
Account acc=[Select id,name from Account where name=’madhuri’ limit 1];
Acc.name=’y madhuri’;
Update acc;
}
If(trigger.isAfter && Trigger.isUpdate)
{

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 175
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

TriggerVar.flag=true;
Account a=new Account(name=’satish’);
Insert a;
}
}
➔ In this case the trigger operation will be executed only when flag value will be false.once the trigger is
executed for the first time the flag values are set to true.

NOTE:- The flag variable should be a static variable.


Q:- can we call batch apex in the trigger?
Ans:- Yes we can call batch apex from the trigger.but salesforce allows only 5 batch jobs in the queue. So if
the trigger raises an error if more than 5 jobs.
Q:- can we call callouts from the trigger?
Ans:- We can not call the callouts directly from the trigger,instead we will define callouts in the future
annotated methods & this future annotated methods can be called from the trigger.
NOTE:- We can only call 10 callouts in a single transaction.

Order of execution in triggers:-


When we save a record with an insert update or upsert statement salesforce performs the events in
order because when the event happens, order of execution is vary important because they are multiple things
field to a single event and when the event gets fired we need to know which processor is running first and which
processes is running last.
The order of execution is in the following order.
1. Executes all before triggers.

2. System validations are performed

3. Custom validations are performed

4. Saves the record but does not commit.

5. Executes all after triggers

6. Executes assignment rules

7. Executes auto response rules

8. Executes workflow rules.

9. If the record was updated with workflow field updates,fires before and after triggers are moretime in
addition to standard validations.Custom validations rules are not run again.

10. Executes escalation rules.

11. Commits to the database.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 176
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Trigger context variable:-


There are some implicit variables that are defined with in a trigger. That allows the developers to access
runtime context.
➔ These variables are defined in System.Trigger class.

1) Trigger.New:- this stores list of new records of Sobjects which we are trying to insertinto database or list
of records which we are going to update.

➔ This variable is available in trigger which perform insert events or update events.

2) Trigger.NewMap:- this is a mapofids as keys the new versions of the Sobject records as values.

Map<ID,Sobject>
These will be available only in after insert,after update and before update triggers.
3) Trigger.old:- Returns a list of the old versions of the Sobject records.(this will store the list of old records
with old values what it has before the operation)

This is available in before update,after update,before delete,after delete.


NOTE:- We can only perform read operation on Trigger.old records.
Trigger.oldmap:- A map of Ids to the old versions of the Sobject records.
Syntax:- Map<ID,Sobject>
Note that this map is only available in update and delete triggers.
Trigger.isExecuting:- Returns true if the current context for the apex code is trigger,not a visualforce page, a
webservice or an executeanonymous()API call.
Trigger.isInsert:-Returns true if this trigger was fired due to an insert operation, from the salesforce user
interface,apex or the API.
Trigger.isUpdate:- Returns true if this trigger was fired due to an update operation,from the salesforce user
interface,Apex or the API.
Trigger.isDelete:- Returns true if this trigger was fired due to a delete operation,from the salesforce user
interface,Apex or the API.

Operations That Don't Invoke Triggers


Triggers are invoked for data manipulation language (DML) operations that are initiated or
processed by the Java application server. Therefore, some system bulk operations don't invoke
triggers. Some examples include:
• Cascading delete operations. Records that did not initiate a delete don't cause trigger
evaluation.
• Cascading updates of child records that are reparented as a result of a merge operation
• Mass campaign status changes
• Mass division transfers
• Mass address updates
• Mass approval request transfers
• Mass email actions
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 177
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• Modifying custom field data types


• Renaming or replacing picklists
• Managing price books
• Changing a user's default division with the transfer division option checked
• Changes to the following objects:
• BrandTemplate
• MassEmailTemplate
• Folder
• Update account triggers don't fire before or after a business account record type is changed
to person account (or a person account record type is changed to business account.)

Fields that Cannot Be Updated by Triggers


• Task.isClosed

• Opportunity.amount*

• Opportunity.ForecastCategory

• Opportunity.isWon

• Opportunity.isClosed

• Contract.activatedDate

• Contract.activatedById

• Case.isClosed

• Solution.isReviewed

• Id (for all records)**

• createdDate (for all records)**

• lastUpdated (for all records)

* When Opportunity has no lineitems, Amount can be modified by a before trigger.

** Id and createdDate can be detected in before update triggers, but cannot be modified.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 178
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Trigger Best Practices \Implementing Trigger Framework


1) One Trigger Per Object
A single Apex Trigger is all you need for one particular object. If you develop multiple
Triggers for a single object, you have no way of controlling the order of execution if those
Triggers can run in the same contexts

2) Logic-less Triggers
If you write methods in your Triggers, those can’t be exposed for test pDo not fetch
unnecessary data. Only fetch those fields and objects in your SOQL that you really
require.urposes. You also can’t expose logic to be re-used anywhere else in your org.

3) Context-Specific Handler Methods


Create context-specific handler methods in Trigger handlers

4) Bulkify your Code


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

5) Avoid SOQL Queries or DML statements inside FOR Loops


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

Never ever write a SOQL query inside any “for” loop for whatsoever reason.

Do not fetch unnecessary data. Only fetch those fields and objects in your SOQL that you
really require.

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


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

7) Querying Large Data Sets


The total number of records that can be returned by SOQL queries in a request is 50,000. If
returning a large set of queries causes you to exceed your heap limit, then a SOQL query for
loop must be used instead. It can process multiple batches of records through the use of
internal calls to query and queryMore
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 179
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

8) Use @future Appropriately


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

9) Avoid Hardcoding IDs


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

10)Never ever perform a DML operation inside a “for” loop.

Custom Settings
Custom settings are similar to custom objects and enable application developers to create
custom sets of data, as well as create and associate custom data for an organization, profile,
or specific user. All custom settings data is exposed in the application cache, which enables
efficient access without the cost of repeated queries to the database

Custom setting is two types

1. List custom setting

2. Hierarchy custom setting

Limits in Custom Settings:

• 300 fields per custom setting.


• Custom setting object record cannot be shared.
• When a custom setting owner can’t be changed.
• Custom setting counts against the total number of custom objects available for the
organization.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 180
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

JavaScript
JavaScript (js) is a light-weight , cross-platform object-oriented programming
language that enables dynamic interactivity on websites when applied to an HTML
document.

JavaScript is not a compiled language, but it is a translated language.

JavaScript accepts both double and single quotes

Application of JavaScript

• Client-side validation,
• Displaying pop-up windows and dialog boxes (like an alert dialog box, confirm dialog
box and prompt dialog box)

AJAX
The AJAX Toolkitis a JavaScript wrapper around the API

• The AJAX Toolkitis available for any organization that has API access.
• The AJAX Toolkit supports Microsoft Internet Explorer versions 9, 10, and 11 with the
latest Microsofthot fixes applied, and Mozilla.
• The AJAX Toolkit is based on the partner WSDL. Because there is no type checking in
JavaScript, the type information available in the enterprise WSDL is not needed
• You can execute any call in the API, and access any API object that you normally have
access to.
• You can issue asynchronous calls, and use callback functions to handle the results.
• The AJAX Toolkit supports relationship queries.

Eg:

01. Include Library:

{!REQUIRESCRIPT("/soap/ajax/45.0/connection.js")}

{!REQUIRESCRIPT("/soap/ajax/45.0/apex.js")}

02. Record Identification

var o = new sforce.SObject("Opportunity");

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 181
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

o.id = "{!Opportunity.Id}";

03.Modification:

o.StageName = "Closed Won";

04. Action(DML):

sforce.connection.update([o]);

05. Reload(Rerender):

window.location.reload();

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 182
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Interview Questions
Separate 500+ Interview Question (Admin & Development) PDF
file will be shared through Google Drive.

Separate Interview Question For Lightning will be shared


through Google Drive.

Separate Interview Question For Lightning Web Component


(LWC) will be shared through Google Drive.

Sample Interview Questions


Question: How is Role Different from the Profile?
Answer:- Roles and Profiles are two different concepts in Salesforce.com, Some of the basic differences are:

• Profile helps to put restrictions on the Object where as the Role helps in opening the records to the
users above the Role hierarchy
• Profile manages the Salesforce.com License, Tabs Settings, Record types, Page layouts, General
Settings, Administrator Settings etc; Role hierarchy does not do any of these things
• Profile is Mandatory, Role is not

Question:- What are the different ways of making a field mandatory?


Answer: 3 ways of making the field mandatory are:-

1. Page Layout:- Field can be made mandatory from the page layout when it needs to be made
mandatory for a set of users
2. Field Level Security:- Field can be made mandatory from the FLS when it needs to be made
mandatory for all the users in the Organization and even from the API’s
3. Validation Rule:- Field can be made mandatory from the Validation Rule when it needs to be made
mandatory for user who is using the same Page layout used by other users

Salesforce.com recommends using the Page Layout option for making the field mandatory.

Question:- What are the Different Ways in which leads can be created in salesforce.com?
Answer:- Some of the ways in which leads can be generated and created in salesforce.com are

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 183
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• Walk In to a company: User comes to the company office and then Salesforce.com rep manually
creates the Lead
• Data Base bought by the company and then leads loaded via Data Loader/Import Wizard in
salesforce.com
• Leads created because of the Campaigns, Seminars, and Tradeshows
• Web to Lead:Users registering on the website of the company.
• Email to Lead & SMS to Lead can be custom build for the Organization

Question: Can a Contact be part of Partner Portal as well as Customer Portal in salesforce.com?
Answer:- Yes, a contact can be part of a Partner Portal as well as Customer portal in salesforce.com.
Customer Portal and Partner portal depend on the user object and are not related to the contact object.
So to enable both portals for a Contact we need to create two users which will utilize two different
salesforce.com licenses, one license for Customer portal and other for Partner portal.
Both users created for a same contact will have two different profiles, One for Customer portal and other
for Partner Portal
Question:- When are the Record types used?
Answer:- Record Types are used in the following two cases

1. To assign the different Page layouts to different users based on their profiles
2. To enable different sets of Standard/Custom Picklist values for two different users using the same
page layout

Question:- Why Use Triggers?

Answer: Triggers are used to perform immediate actions based on previous action e.g. field update. An
apexlanguage is used to write triggersEg: Account merge

Question:- What are different types of Triggers?

Answer: There are two types of triggers

Before trigger- is used before database operation

Answer: After trigger-is used to access field values that are set by the database (such as arecord's Id or
lastUpdated field), and to affect changes in other records, such as logging into an audittable or firing
asynchronous events with a queue.

Question:- Why Use Visual Force?

Answer: Visual force is a Sales force UI markup language using visual force we can construct WebPages. In
Salesforce MVC architecture Visual force represents View.

Question:- How do you handle errors?

Answer: Error handing is done directly displaying in Visual force page using Apex Pages methods to end
users ordisplaying in debug logs

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 184
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Question:- What is a Component?

Answer: In sales force component is a reusable piece of code developed using Visual force and Apex
controller.

1. What is Apex

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

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 code ?


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

6.What are Apex Governor Limits?

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 185
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

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

7. How to create and host S Control in Salesforce ?

1. Click on “Setup” which is located on the top right corner of the force.com page.
2. Expand “Develop” item and click on “S-Controls”
3. Hit “New Custom S-Control”
4. Provide a Label “Google Map” and a description is you wished to
5. The Type should be HTML since we want to create a HTML, Google API mash up
6. Now it is time to enter the code for the S-Control

8. Difference between Sandbox and Development environment?

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, 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 don’t 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 instance’s 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.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 186
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

To get a copy of Developer Edition for yourself or your company go here. Play around with it. Get apps
from the AppExchange. Do anything and everything that you have been scared to do your live system. If
you come up with a clever way of using the system, post it on AppExchange and share your knowledge

9. How to schedule export or take the backup of salesforce?

Click Setup >Data Management > Data Export > Schedule Export.
Select the desired encoding for your export file. Leaving the default is fine.
Check the Include in export checkbox if you want to include attachments in the export (optional)
Leave the default Replace carriage returns with spaces if you want your export files to have spaces
instead of carriage returns.
Select Weekly as the the frequency for the exports.
Choose start and end dates. Set the end date to sometime in the distant future such as 20 years from the
begin date.
Set the time of day for your scheduled export. The export is put in a job queue and the exact time of the
export will depend on the amount of activity in the queue.
You can select the types of data to include in your export. It is best to include all data in your export file.
This will make sure all your organizations data is exported.

Click Save

10. Do governor limits apply to sandbox instances?

Ans : Governor limits do apply to all Salesforce instances (trial, developer, production or sandbox
environments). However code coverage and successful execution of test classes is only enforced when
deploying to a production environment.

11. 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.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 187
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• 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)

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

12. 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 sandboxorganization. In
a Salesforce.com production organization, you can only make changes to Apex by using the Metadata API ,

deploycall, 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.

13. When you can’t add Time dependent action in Workflow rule?
You can’t add time-dependent actions to a rule if you choose Every time a record is created or edited.

14. What is Roll up summary field in Salesforce?

Roll up summary field in salesforce calculates the Count, Sum, Min or Max of particular field of any child
record. Thus, we can say that Roll up summary field can only be created on Master object

15. What will happen if the Account is deleted?

If the Account is deleted then Contact, Opportunity will also be deleted from Salesforce which are related to
that Account.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 188
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

16. How many types of the relationship fields available in Salesforce?

Ans :

1. Master Detail
2. Many to Many
3. Lookup
4. Hierarchical (It is available only on User Object, we cannot create this relationship)
5. 19. How to create many to many relationships between object?
6. 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.
7. Create both objects which should be interlinked.
8. 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.

17. 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)

18. If one object in Salesforce have 2 triggers which runs “before insert”. Is there any way to control
the sequence of execution of these triggers?

Ans : Salesforce.com has documented that trigger sequence cannot be predefined. As a best practice
create one trigger per object and use comment blocks to separate different logic blocks. By having all logic
in one trigger you may also be able to optimize on your SOQL queries.

19. How to delete the User from Salesforce?

Ans : As per now, salesforce does not allow to delete any user, however you can deactivate the user.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 189
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

20. How to delete the users data from Salesforce?

Ans : To delete the Users Data go to Setup | Administration Setup | Data Management | Mass Delete
Record, from there select the objects like Account, Lead etc and in criteria select the users name and delete
all records of that user related to particular object.

21. How to restrict the user to see any record, lets say opportunity?

Ans : set up opportunity sharing to be private. If both users are admins or have view all records on
opportunity, then that overrides private sharing.

22. What is the difference between trigger.new and trigger.old in Apex – 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

beforetriggers.

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.

23. 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

24. Where is the option of the report for the “Custom Object with related object” and what are the
condition to generate related reports?
Ans :

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 190
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

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” 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”.

25. 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”.

26 : What is the dynamic Apex?


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

27 : How to get the list of all available sobject in salesforce database using Apex (Dynamic Apex)?
Ans:

1 Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe();

28 : How to get all the required fields of sObject dynamically?


Ans:
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 field 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
4. 35 : How to display error messages in the visualforce page ?
Ans:
In Apex use below code to create the error message for visualforce.

Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, 'Required fields are missing. '));

5. in Visualforce page add below tag where you want to display the error message.
6. <apex:pageMessages ></apex:pageMessages>
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 191
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

29 : What is property in Apex? Explain with advantages.


Ans:
Apex mainly consist of the syntax from the well known programming language Java. As a practice of
encapsulation in java we declare any variable as private and then creates the setters and getters for that
variable.

30 : What is the controller extension ?


Ans:
Any apex class having a public constructor with Custom Controller or Standard Controller object as a single
argument is known as controller extension.

31 : Explain the need or importance of the controller extension.


Ans:
Controller extension is very useful and important concept introduced by the salesforce recently. It gives the
power to programmer to extend the functionality of existing custom controller or standard controller.
A Visualforce can have a single Custom controller or standard controller but many controller extensions.
we can say that the custom extension is the supporter of custom or standard controller.
Consider one example : If there is one controller written and used by the multiple visualforce pages and
one of them needs some extra logic. Then instead of writing that logic to controller class (Which is used by
many visualforce pages) we can create a controller extension and apply to that page only.

32 : How to read the parameter value from the URL in Apex?


Ans:
Consider that the parameter name is “RecordType”.

String recordType = Apexpages.currentPage().getParameters().get('RecordType');

33. What is Master Detail relationship and look up relationship in Salesforce?


Ans:
Master Detail relationship is the Parent child relationship. In which Master represents Parent and detail
represents Child. If Parent is deleted then Child also gets deleted. Rollup summary fields can only be
created on Master records which will calculate the SUM, AVG, MIN of the Child records.
Look up relationship is something like “has-a” (Containership) relationship. Where one record has
reference to other records. When one record is deleted then there is no impact on other records.

33. Can we convert the lookup relationship to Master Detail relationship?


Ans:
We can convert the lookup relationship to master detail relationship if and only if all the existing record
has valid lookup field.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 192
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

34. In How many way we can invoke the Apex class?


Ans:

1. Visualforce page
2. Trigger
3. Web Services
4. Email Services

35. Can we create Master Detail relationship on existing records?


Ans:
No. As discussed above, first we have to create the lookup relationship then populate the value on all
existing record and then convert it.

36. How validation rules executed? is it page layout / Visualforce dependent?


Ans :
The validation rules run at the data model level, so they are not affected by the UI. Any record that is saved
in Salesforce will run through the validation rules.

37. What is the difference between database.insert and insert ?


Ans:
insert is the DML statement which is same as databse.insert. However, database.insert gives more
flexibility like rollback, default assignment rules etc. we can achieve the database.insert behavior in insert
by using the method setOptions(Database.DMLOptions)
Important Difference:

• If we use the DML statement (insert), then in bulk operation if error occurs, the execution will stop
and Apex code throws an error which can be handled in try catch block.
• If DML database methods (Database.insert) used, then if error occurs the remaining records will be
inserted / updated means partial DML operation will be done.

38. What is the scope of static variable ?


Ans:
When you declare a method or variable as static, it’s initialized only once when a class is loaded. Static
variables aren’t 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.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 193
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

39. Other than SOQL and SOSL what is other way to get custom settings?
Ans:
Other than SOQL or SOSL, Custom seting have there 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();

40. What happen if child have two master records and one is deleted?
Ans : Child record will be deleted.

41. What is Difference in render, rerender and renderas attributes of visualforce?


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

42. What is Scheduler class in Apex?


Ans:
The Apex class which is programed to run at pre defined interval.
Class must implement schedulable interface and it contains method named execute().
There are two ways to invoke schedular :

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 “

43. Explain Permission sets released in Winter 12.


Ans :
A permission set is a collection of settings and permissions that give users access to various tools and
functions. The settings and permissions in permission sets are also found in profiles, but permission sets
extend users’ functional access without changing their profiles. 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.
While users can have only one profile, they can have multiple permission sets.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 194
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

44. What is the difference between External ID and Unique ID?


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

45. How to get the picklist value in Apex class?


Ans :
Using Dynamic apex, we can achieve this.on object of type pickilist, call getDescribe(). then call the
getPicklistValues() method. iterate over result and create a list. bind it to <apex:selectOptions>.

46. What are the types of controller in visual force?


Ans :
There are basically two types of Controller in Visual force page.

1. Standard Controller and


2. Custom Controller

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 195
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

47. How many Controllers can be used on single VF page?


Ans :

Only one controller can be used salesforce. Other than them, Controller extension can be used. There may
be more than one Controller extention

48. Explain System.runAs()


Ans :
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 user’s 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.

49. Explain Test.setPage().


Ans:
It is used to set the context to current page, normally used for testing the visual force controller.

50. What is the custom settings ?


Ans :
Custom settings are similar to custom objects and enable application developers to create custom sets of
data, as well as create and associate custom data for an organization, profile, or specific user. All custom
settings data is exposed in the application cache, which enables efficient access without the cost of
repeated queries to the database. This data can then be used by formula fields, validation rules, Apex, and
the Web services API.

51. Types of the custom settings?


Ans :
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 low-cost and
efficient: you don’t 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.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 196
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

52. Difference between SOSL and SOQL in Salesforce ?


Ans :

SOSL SOQL
stands for "Salesforce object query
stands for "Salesforce object search language".
language".
Need to write different SOQL for
Works on multiple object at a same time.
different object.
All fields are already text indexed. SOQL against same field will be slow.
Cannot used in Triggers. Can only be used in Apex class and
Can be used in Apex class and Triggers.
anonymous block.

53. How to round the double to two decimal places in Apex?


Ans:

1 Decimal d = 100/3;
2 Double ans = d.setScale(2) ;

54.In Profile settings, what is difference between “Modify All Data” and “Modify All” ?
Ans:
Modify All Data : Create, edit, and delete all organization data, regardless of sharing settings.
Modify All : Give All (Read, Create, Add, Delete) permission to selected Object.

55. If i want record level access then what should i use from Salesforce security model?
Ans: Manual Sharing

56. If i want Object level access then what should i use from Salesforce security model?
Ans: Profile

57. In OWD (Organization wide sharing), can i change the setting “Grant Access Using Hierarchies”
for Standard Objects ?
Ans: You cannot change it for Standard Objects However for Custom Objects its possible.

58. What is Mandatory while creating User, Role or Profile?


Ans : Its Profile.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 197
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

59. In case of Master-Detail relationship, on Update of master record can we update the field of
child record using workflow rule?
Ans: No

60. In case of Master-Detail relationship, on Update of child record can we update the field of Parent
record using workflow rule?
Ans: Yes, the Master fields are also available for “Criteria evaluation”.

61. While setting OWD (Organization wide sharing), can we change/modify the setting of child
record in case of Master-Detail relationship?
Ans: No, Child record is controlled by the Parents setting.

62. What is the need of “Custom Controller” in Visualforce as everything can be done by the
combination of Standard Controller + Extension class.
Ans :

• Sharing setting is applied on standard object/extension by default; In case we don’t want to apply
sharing setting in our code then Custom controller is only option.
• 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.

63. In class declaration if we don’t write keyword “with sharing” then it runs in system mode then
why keyword “without sharing” is introduced in apex?
Ans:
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”.

64. If user doesn’t have any right on particular record and have only read level access at object
level. Can he change the record owner?
Ans : Yes. In profile, there is setting for “Transfer Record”.

65. In Which Scenario share object “MyCustomObject__share” is not available/created for custom
object “MyCustomObject” ?
Ans: The object’s organization-wide default access level must not be set to the most permissive access
level. For custom objects, this is Public Read/Write. For more information, see Access Levels. This object is
used for creating Apex based sharing.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 198
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

66. How to hide the “App Setup” Menu from user’s setup page?
Ans : In Profile, remove access “View Setup and Configuration”.

67. While creating new profile for user, which existing profile should be copied?
Ans: If the new user is not System administrator then copy from “Standard User” profile.

68. Who can run reports?


Ans : Users with permission “Run Report” and access to report folder can only run the report.

69. What is Difference between “printable View” and “Export Details“ button on report?
Ans:
Printable View: formatting, grouping and subtotals are persisted.
Export Details: formatting, grouping and subtotals are lost.

70. What is the use of “floating report header”?


Ans: If you have long tabular report, you can make the column header visible on each pages as you scroll,
by enabling floating report headers.

71. How to enable “floating report header”?


Ans :
Go to “Setup | App Setup | Customize | Report and Dashboard | User Interface Settings “.
Click on checkbox “Enable Floating Report Headers”.

72. Which permission is required to set the running user other than you in dashboard?
Ans: “View All Data” in profile.

73. Who can access “drag and drop dashboard”?


Ans : User with permission “manage dashboard”.

74. Which type of report can be used for dashboard components?


Ans : Summary and matric report.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 199
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

75. How many types of dashboard components are available?


Ans : Chart, Table, Metric and Gauge.

76. Explain dynamic Dashboard.


Ans : Dashboard which is running under current logged in user permission are known as “dynamic
Dasboard”. At the most 3 dynamic dashboards can be built. Available in Unlimited, Enterprise and
developer edition. This type of dashboard cannot be scheduled for refresh. IT must be scheduled manually.

77. What is the default timeout period while calling webservice from Apex.
Ans : 10 sec.

78. A single Apex transaction can make how many callouts to an HTTP request or an API call ?
Ans : Maximum 10 callouts

79. How to increase timeout while calling web service from Apex ?
Ans :

1 docSample.DocSamplePort stub = new docSample.DocSamplePort();


2 stub.timeout_x = 2000; // timeout in milliseconds

80. How to show loading image while Ajax call in Visualforce? OR how to show image in
<apex:actionStatus> tag in Visualforce?
Ans:

<div style="position:absolute;top:20px;left:
1
50%;">
2 <apex:actionStatus id="refreshContent" >
3 <apex:facet name="start" >
4 <apex:image url="{!$Resource.LoadingImage}" />
5 </apex:facet>
6 </apex:actionStatus>
7 </div>

81. What is analytic Snapshot in salesforce?


Ans : Analytic snapshot capture and store the data at pre decided intervals. It captures data from report
and saves in custom object as per schedule. It only supports tabular and summary report as a source
report. It does not support matrix report. The field type in target object must be same as source report
object field.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 200
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

82. What is difference between Mobile Lite and Salesforce Mobile?


Ans :

Feature Mobile Lite Salesforce Mobile


Edit capabilities All standard objects Any app, any record
Any - includes custom fields, objects, tabs,
Customizations Supports custom fields
configurations
Records Most recently used records; search only All records
Leads, accounts, contacts, opportunities,
Objects tasks, events, cases, solutions, assets, All objects
and dashboards
Custom objects None Any
Initial set of records Recently viewed on Web Fully configurable
Download
Using live search Using live search
additional records
Secured data access and over-the-air Secured data access and over-the-air
Security
management management
Free for Unlimited Edition customers;
Price Free for all editions of Salesforce available in Professional Edition and
Enterprise Edition for a fee

Difference between Mobile lite and Salesforce Mobile

Mobile Lite is a free, restricted version of Salesforce Mobile that is available to any Salesforce user who
doesn't have a mobile license.

Mobile lite is not supported by the customer portal and partner portal.

83. What is features of “Manage Members” in campaign records?


Ans :

Campaign members are created from lead, contact, or person account records. Salesforce provides a
variety of ways in which you can manage your campaign members. You can add and update up to 50,000
campaign members at a time through lead, contact, and person account reports; you can search for and add
or edit multiple leads and contacts from the Manage Members page; you can add an unlimited number of
leads and contacts using a CSV import file; or you can add members to a campaign one at a time from
contact or lead detail pages.

84. How to add the Document Header in Visualforce page?


Ans : Directly there is no way to add the document type in visualforce. However in most of the cases IE9
does not work with Visualforce pleasantly. And then we need to add the Document type in header. So
following workaround will work.

1 <apex:outputText

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 201
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

2 escape="false"
value="{!'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
3
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">'}"/>
4 <html>
5 <head>
6 <title>test</title>
7 </head>
8 <body>test</body>
9 </html>
10 </apex:page>

85. Onchange event does not work with <apex:actionsupport> in IE9. How to resolve this error?
Ans: If we hide the Header on Visualforce page then it creates lots of problem in IE9. I think there are few
java-script library loaded by Header of Salesforce which makes IE9 compatible. So the best solution is to
enable the Headre by using “showHeader=true” in Apex page.

86. If IE9 is not working with your custom visualforce page then how to tell your visualforce code to
run in IE8 compatibility mode?
Ans:
Add following metatag to pages:

1 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />

87. It may happen that above tips will not work as lots of time the page header already sent. then
how to achieve same result using Apex?
Ans:
Add below line of code in Apex (Constructor)

1 Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');

88. How to display the formatted number / date in Visualforce ? Which component should be used?
Ans : Use component “<apex:outputText>”.
Example : Format the number into currency.

1 <apex:outputtext value="{0, number, 000,000.00}">


2 <apex:param value="{!valFromController}" />
3 </apex:outputtext>

OR

1 <apex:outputtext value="{0, number, ###,###.00}">


2 <apex:param value="{!valFromController}" />
3 </apex:outputtext>

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 202
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

89. You want to display the Encrypted field on Visualforce and you are using component
apex:outputText. Will it work for Encrypted fields?
Ans : Encrypted custom fields that are embedded in the <apex:outputText> component display in clear
text. The <apex:outputText> component doesn’t respect the View Encrypted Data permission for users. To
prevent showing sensitive information to unauthorized users, use the <apex:outputField> tag instead

90. Explain difference in COUNT() and COUNT(fieldname) in SOQL.


Ans :

COUNT()

• COUNT() must be the only element in the SELECT list.


• You can use COUNT() with a LIMIT clause.
• You can’t use COUNT() with an ORDER BY clause. Use COUNT(fieldName) instead.
• You can’t use COUNT() with a GROUP BY clause for API version 19.0 and later. Use
COUNT(fieldName) instead.

COUNT(fieldName)

• You can use COUNT(fieldName) with an ORDER BY clause.


• You can use COUNT(fieldName) with a GROUP BY clause for API version 19.0 and later.

91. How to write the “Where” clause in SOQL when GroupBy is used ?
Ans : We cannot use the “Where” clause with GroupBy instead we will need to use the “Having Clause“.
Example : Get all the opportunity where more than one record exists with same name and name contains
“ABC”.

1 SELECT COUNT(Id) , Name FROM Opportunity GROUP BY Name Having COUNT(Id) > 1 AND Name like '%ABC%'

92. Lets consider that the first component in VF page is the Datepicker. In that case whenever the
page loads, salesforce auto focus the first component resulting in Datepicker onfocus event.
Because of this the Datepicker component opens automatically. How we can avoid this?
Ans :

On load event, write the javascript code to autofocus any other field or any other non-visible component.
Example :

view source
print?
1 <span id="focusDistraction"></span>
2 <script type="text/javascript">
3 /* prevent autopup of the date inputfield by the default focus behavoir */
4 window.onload=function() {
5 document.getElementById('focusDistraction').focus();

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 203
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

6 }
7 </script>

93. How to force lead assignment rule via Apex while updating or adding the Lead?
Ans : 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

94. How to implement the pagination in SOQL ?

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

103. Access custom controller-defined enum in custom component ?


Ans :

We cannot reference the enum directly since the enum itself is not visible to the page and you can’t make it
a property.

95. What is dynamic binding in salesforce?


Ans:
Dynamic Visualforce bindings are a way of writing generic Visualforce pages that display information about
records without necessarily knowing which fields to show. In other words, fields on the page are
determined at run time, rather than compile time. This allows a developer to design a single page that
renders differently for various audiences, based on their permissions or preferences. Dynamic bindings are
useful for Visualforce pages included in managed packages since they allow for the presentation of data
specific to each subscriber with very little coding.

Example 1:
Access the Account name from Contact.

1 {!myContact['Account'][fieldname]}

Example 2:

Consider Data type in Apex

1 public Map<String, List<Account>> accountsMap {get; set;}

Visualforce page:

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 204
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

1 <apex:variable value="A" var="selectedKey" />


2 <apex:pageBlockTable value="{!accountsMap[selectedKey]}" var="acc">
3 <apex:column value="{!acc.name}"/>
4 <apex:column value="{!acc.BillingStreet}"/>
5 <apex:column value="{!acc.BillingCity}"/>
6 <apex:column value="{!acc.BillingPostalCode}"/>
7 </apex:pageBlockTable>

96. Consider total 90k records present in Salesforce and you have used the count() method of soql.
What will be output of it?
Ans : It will throw an error something like “Too many query rows: 50001”, as the record limit in SOQL is
50,000.
Although the count() returns only one row however it processes each record and thus hit the allowed
governor limit.

97. How can you determine that email is actually sent or not from the salesforce?
Ans:
There is an Email log that you could use. It’s available in the setup menu under Monitoring.

It’s only for the past 30 days and you would have to manually check it.

From the email log page: “Email logs describe all emails sent through salesforce.com and can be used to
help identify the status of an email delivery. Email logs are CSV files that provide information such as the
email address of each email sender and its recipient, the date and time each email was sent, and any error
code associated with each email. Logs are only available for the past 30 days.”

98. In salesforce which fields are indexed automatically?


Ans :
The following fields are indexed by default:

• primary keys (Id, Name and Owner fields),


• foreign keys (lookup or master-detail relationship fields),
• audit dates (such as LastModifiedDate),
• Custom fields marked as External ID or Unique.

99: Give any scenario when you cannot change the currency field type to numeric type.
Ans : When the field is used either in Apex class or trigger.

100: How to get the Recordtype Id using Dynamic Apex?


Ans:
Normally to get the RecordtypeId for any sObject we use SOQL and it will count against your limit. So below
method will bypass the need of SOQL Query.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 205
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

1 Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe() ;


2 Schema.SObjectType s = m.get('API_Name_Of_SObject') ;
3 Schema.DescribeSObjectResult cfrSchema = s.getDescribe() ;
4 Map<String,Schema.RecordTypeInfo> RecordTypeInfo = cfrSchema.getRecordTypeInfosByName();
5 Id rtId = RecordTypeInfo.get('Record Type Name').getRecordTypeId();

101 : Write Apex code which will take the RecordID as input and on the basis of that it will print the
Object name and field names of sObject.
Ans:

1 List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();
2 Map<String,String> objectMap = new Map<String,String>();
3 for(Schema.SObjectType f : gd)
4{
5 objectMap.put(f.getDescribe().getKeyPrefix(), f.getDescribe().getName());
6}
7
8 String sampleId ='00390000003LIVw';
9 String prefix = sampleId.substring(0,3);
10 String objectName = objectMap.get(prefix);
11 System.debug('** SObject Name ** '+objectName);
12
13 Map<String, Schema.SObjectField> desResult = Schema.getGlobalDescribe().get(objectName).getDescribe().Fields.getMap();
14 List<String> fieldList = new List<String>();
15 fieldList.addAll(desResult.keySet());
16 for(integer i =0;i<fieldList.size();i++)
17 {
18 System.debug('** Field Name ** '+fieldList[i]);
19 }

102. Consider a scenario where you have created a Visualforce page and Controller. You want to
restrict the controller action for users which are logged in using “Grant Login Access”. How to
acheive this?

Ans:

When System admin logged in on the behalf of any other user. On upper right corner message is displayed
that user is logged-in on behalf of some other user. In Visualforce page we can search for the element with
class name present or not? If the element with that Class name exist means logged-in user is not a actual
user.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 206
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

103. How to get “https” link instead of “http” for Visualforce page using URLFOR() in Email
Template ?
Ans: When you create the Link using URLFOR() in Email Template, it creates link in “http” format instead
of “https” and thus causes end user to logged into salesforce again.

So instead of

<a href='{!URLFOR('/apex/SomePage', null, [id=Some_Object__c.Id,retURL="/apex/SomeOtherPage"])}'>Go to SomePage


1
here!</a>

We can use something like :

<a href='{!SUBSTITUTE(URLFOR('/apex/SomePage', null,


1
[id=Some_Object__c.Id,retURL="/apex/SomeOtherPage"]),'http:','https:')}'>Go to SomePage here!</a>

104. What is the best way to check whether organization have PersonAccount enable or not using
Apex?
Ans:

Method 1:

1 // Test to see if person accounts are enabled.


2 public Boolean personAccountsEnabled()
3{
4 try
5 {
6 // Try to use the isPersonAccount field.
sObject testObject = new
7
Account();
8 testObject.get( 'isPersonAccount' );
9 // If we got here without an exception, return true.
10 return true;
11 }
12 catch( Exception ex )
13 {
14 // An exception was generated trying to access the isPersonAccount field
15 // so person accounts aren't enabled; return false.
16 return false;
17 }
18 }

Method 2:

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 207
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

1 // Check to see if person accounts are enabled.


2 public Boolean personAccountsEnabled()
3{
4 // Describe the Account object to get a map of all fields
5 // then check to see if the map contains the field 'isPersonAccount'
6 return Schema.sObjectType.Account.fields.getMap().containsKey( 'isPersonAccount' );
7}

105 : When you get the error “Non-selective query against large object type”? how to resolve it?
Ans : Whenever an object has greater than 100K records any query on that object must be “selective”. For a
query to be selective it must have enough indexed filters (where clauses) so that less than 10% of the
records (in our example 10K) are returned before applying the limit statement.

106 : How to get the debug log of Connection user in salesforce to salesforce Integration?
Ans : When configuring Debug Logs, you cannot choose a Salesforce to Salesforce Connection User from the
User Lookup, but there is a workaround to

achieve this.

To begin capturing Debug Logs for a Connection User open the following URL in your browser:

https://XXX.salesforce.com/p/setup/layout/AddApexDebugLogUser?retURL=%2Fsetup%2Fui%2FlistApe
xTraces.apexp&UserLookupInput_lkid=YYYYYYYYYYYYYY
&UserLookupInput=Connection%20User

Replace XXX with your salesforce instance, UserLookupInput_lkid is the ID of the Connection User and
UserLookupInput is the User name. You can find

the user ID of the connection user, by inspecting the CreatedById for a record created by this user. (eg. via
eclipse or Force.com explorer)

107 : In Controller extension, you are getting the error “SObject row was retrieved via SOQL without
querying the requested field” while accessing the field of parent Custom Object or standard Object
for which the Controller extension was written. How to resolve that?
Ans : In Constructor of the Controller extension, only Id of Custom Object is supplied. We need to query all
the required field explicitly in order to use in remaining part of the code.

108: Using Apex how you can determine that user is in Sandbox or production?
Ans : read this URL for answer

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 208
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

109: Can you use aggregate expressions inside inner query?


Explanation – Can you use Group by clause inside inner query in SOQL?
Example : Something like :

1 SELECT Id, Name,(SELECT Count(Id),Name FROM Contacts Group By Name Having count(Id) > 1 ) FROM Account

Ans: No. only root queries support aggregate expressions. Return type is List<AggregateResult> for
above query However the root result expects List<Account> and there is no syntax or provision available in
Salesforce to specify that child results are of type “AggregateResult“.

110 : Consider we have overall 90% code coverage however there is one class which have 0% code
coverage. Can we still able to deploy that class on production?
Ans : Yes. Minimum 1% required for every trigger and there is no such restriction for Apex class.

111 : How to get selected records ID from List View using Javascript / Ajax Toolkit, when custom
button is added on List View page?
Ans : Create a new Button on Lead of type List Button. Add the button on Lead List View Layout and write
below Javascript code:

1 {!RequireScript("/js/functions.js")}
2
3 var recordsSelected = {!GetRecordIds($ObjectType.Lead)}
4 for(var i=0; i < recordsSelected .length ; i++) {
5 alert('Selected ID '+recordsSelected[i]);
6}

112 : In Ajax toolkit for custom Javascript button, you have to explicitly login to API because global
Session variable is not available. In that case it is security vulnerable because anybody logged in can
see the javascript code and your username and password. So is there any way to avoid this?
Ans: We can create a visualforce page with output type as JavaScript. Global session variable is available in
VF page. Initialize the global javascript variable in that VF page. include VF page as a javascript file and we
are done!

113 : In Custom Component How we can return value to Custom Controller or Controller Extension?
Ans: In Apex, Objects are passed by reference. So supply an argument of wrapper class (object) type to
custom component. If its value is changed in Custom component we will get updated value in controller
also.

114 : Lets consider you had created outbound changeset previously. After that, some class is
modified which is part of that old changeset. If you clone that Changeset, current updated class will
be included or that previous class will be included in changset?

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 209
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Ans : Once changeset is created it cannot be modified. After creation of changset, if we modify any
component it will not reflected and when we clone the changeset, all components (offcource old copy of
component) will be added to changeset.

115 : We have a “Time Based Workflow” and there is Action scheduled to be executed. If we
Deactivate the workflow, Scheduled actions will be removed from queue or not?
Ans : Even after deactivation of workflow, its action will be active in queue.

116 : We have “Time Based Workflow” and there is action scheduled to be executed. Can we delete
that workflow?
Ans : If a workflow have any pending time dependent action, then we cannot delete the workflow.

117 : How to clear the Time based workflow action queue ?


Ans : Two ways to achieve this : 1. Make criteria false for all those records. 2. Navigate to “Set up |
Monitoring | Time Based Workflow”, search for scheduled actions and remove from queue.

118 : While creating workflow on Task, what difference observed on available actions?
Ans : “Send Email” action is not available while creating workflow on task.

119 : In trigger, lets say we have system.debug() statement after adderror() method. Will
system.debug() be statement executed in Trigger after adderror() method?
Ans: adderror() method is not error statement rather its normal execution flow and all the statements
written after adderror() will be executed normally.

More Questions

1. How many users have you supported.


2. What are permission sets and how do they differ from profiles.
3. When will you use profile and permission sets together.
4. Difference between roles and profiles.
5. What are controllers.
6. What are extensions.
7. Difference between controllers and extensions.
8. What is a standard controller, custom controller. Difference between the two.
Rupom Chakraborty - Capital Info Solutions
Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 210
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

9. When you override a button by specifying a VF page, what is a necessary condition for the VF page to be
available.
Ans - The VF page should have a standard controller listed for that object. Else, the VF page will not be
available to override a button.
10. Minimum number of queries required to query for 2 level, 3 level relationships.
11. How will you avoid recursive triggers.
12. How to bulkify triggers.
13. Understand basic SOQL and Apex limits.
14. What is with sharing and without sharing class.
15. How can sharing be done using Apex.
16. Explain the trigger handler pattern.
17. List few components which cannot be deployed using force.com IDE or change sets.
18. What deployment methods have you used. List advantages and disadvantages of each.
19. How will you load data for a child object.
20. Difference between a look up and master-detail relationship.
21. Explain, the way you will query child from parent and parent from child
22. What are sharing rules, when do you used sharing rules.
23. Explain lead to opportunity conversion.
24. What are record types. Why are the record types used.
25. When is page layout assignment used.
26. Can 1 user be assigned multiple profiles, if yes how, if not, what is the work around.
27. How many types of salesforce licenses are there. What are the limits.
28. Which license will I use if users will only use 1 custom application.
29. How can I create developer, full sandbox.
30. In how many days can one refresh a full sandbox.
31. What is batch apex. Why do we use batch apex.
32. What is @future method.
33. What are test classes, what is the test coverage you need to move a code into production.
34. Can I directly change code in salesforce production org.
35. How do I log a case with salesforce.
36. How can I change owner for multiple cases at once (example - from Rob to John)
37. Difference between a workflow rule and approval process.
38. What is the order of execution of workflow rules, validation rules, triggers.
39. Explain Salesforce.com security implementation with respect to Profiles, Roles and Hierarchy, Sharing
rules, OWD(org wide default settings). Also, specify which is the most restrictive security setting.
40. What are custom report types.
41. What are different types of reports you can create.
42. What is Trigger.old and Trigger.New
43. What is ApexPages.addMessage
44. How is a pdf generated using visual force page.
45. How can I redirect user to a page after processing is completed in the controller/extension.
46. What are custom settings.
47. What are Action Support, Action Function and Action Poller used for.
48. What is rerender attribute used for.
49. What is package.xml
50. How can one read parameter values through the URL in Apex.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 211
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Sales Force
Certification Syllabus

Administration Essentials (ADM201)


Topic Objective
Identity Confirmation • Activate your computer
Setting Up the User Interface • Set up the UI & search options
Organization Administration • Set your organization’s language & locale
• Manage currency
Customization • Create custom profiles & custom fields
• Define dependent picklists
• Customize lookup fields & formula fields
• Customize page layouts
• Customize standard related lists
• Learn about record types & business processes
• Use field-level security
Security & Access • Create & manage your users
• Set organization-wide defaults
• Learn about record access
• Create the role hierarchy
• Learn about the sharing model
• Manually share records
• Set up opportunity team selling & account teams
• Learn about folder access
Workflow • Define workflow
• Set up workflow rules
• Set up workflow tasks & alerts
Workflow Approvals • Plan approvals using workflow
• Use the approval wizard – standard vs. jump-start
• Create workflow approvals
Data Validation • Learn about Salesforce CRM data validation
• Create data validation rules
• Learn about custom fields & unique properties
Data Utilities • Import records using the import wizards
• Use mass delete
• Use mass transfer
• Learn about storage utilization
Analytics • Create custom reports
• Use advanced filters
• Use conditional highlighting
• Use custom summary formulas

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 212
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• Create dashboards
The AppExchange • Learn about the AppExchange
• Install an app
• Uninstall an app
Marketing Administration • Use the integrated campaign builder
• Learn about lead queue & lead assignment setup
• Learn Web-to-lead & auto-response rules
Service & Support Administration • Learn about cases & solutions
• Set up case escalation rules
• Identify solution categories & suggested solutions
Salesforce Console • Navigate the Salesforce Console
• Create a Salesforce Console
Extending Salesforce CRM • Learn about custom objects
• Learn about custom tabs
• Learn about custom Web tabs

Administration Essentials (ADM202)


Topic Objective
Security Confirmation • Activate your computer
Navigation • Set up Admin options & UI
Organization Administration • Set your organization’s language & locale
• Manage currency
Customization • Create custom fields
• Define dependent picklists
• Customize lookup fields & formula fields
• Customize page layouts
• Customize standard related lists
Security & Access • Create & manage your users
• Set organization-wide defaults
• Learn about record access
• Create the role hierarchy
• Learn about the sharing model
• Manually share records
• Learn about folder access
Data Validation • Learn about Salesforce CRM data validation
• Create data validation rules
• Learn about custom fields required & unique properties
• Learn about role transfer & mass transfer functionality
Data Utilities • Importing records using the import wizards
• Use mass delete
• Use mass transfer
• Learn about storage utilization
Analytics • Create custom reports
• Use advanced filters
• Use conditional highlighting
• Use custom summary formulas
• Create dashboards
The AppExchange • Learn about the AppExchange
• Install an app
• Uninstall an app
Marketing Administration • Learn about lead queue & lead assignment setup
• Learn Web-to-lead & auto-response rules
Service & Support Administration • Learn about cases & solutions
• Set up case escalation rules
• Identify solution categories & suggested solutions
Salesforce Console • Navigate the Salesforce Console
• Create a Salesforce Console
Extending Salesforce CRM • Learn about custom objects
• Learn about custom tabs
• Learn about custom Web tabs
• Build a custom app

ADM301 Advanced Administration


Extending Salesforce – Key Concepts
:: Force.com Web services API
:: Web controls

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 213
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

:: Apex programming language overview


:: Visualforce overview
Managing Data
:: Retrieve data
:: Identify and cleanse dirty data
:: Enter clean data
:: Work with storage limits
Increasing User Adoption
:: Measure adoption and motivate users
:: Use Salesforce CRM in meetings
:: Use Salesforce CRM as a sales portal
:: Train end users
Enhancing Productivity
:: Make Salesforce CRM easier to use
:: Use Salesforce CRM everywhere
:: Increase administrator productivity
Implementing Business Processes
:: Implement management mandates with
workflow and formulas
:: Create additional applications
:: Extend the reach of Salesforce CRM
:: Enforce repeatable processes
:: Audit processes
Expanding Initial Implementations
:: Enhance your sharing model
:: Work as a team
:: Go global
:: Secure your Salesforce CRM implementation
:: Stay current on Salesforce CRM
Visualforce Pages
:: Introduction to the Visualforce framework
:: Visualforce pages, components, and
controllers
:: Incorporate Visualforce pages into Salesforce CRM

Building Applications with Force.com & Visualforce (DEV401)


Designing Applications on Force.com
::: Learn about factors to consider when building a
data model
::: Develop custom objects and fields, encrypted fields, field help, and field history tracking
::: Use master detail, lookup, and many-to-many relationships
::: Create a user interface for custom applications using the Custom Object tab, Page Layout, and Customization options
::: Set field attributes on the page layout
::: Use the Custom Object queue and event-based workflow rules with field update actions
::: Develop custom formulas and validation rules Designing Applications for Multiple Users
::: Learn about factors to consider when designing applications for multiple users
::: Create profiles, understand what a profile controls (including data access), and customize profiles to manage the user experience
::: Customize the user experience with record types and page layouts
::: Control access to records
::: Employ OWD, sharing rules and levels, roles, public groups, and manual share
::: Apply profiles, OWDs, role hierarchy, and sharing to restrict access to sensitive data
::: Apply OWDs, public groups, and manual sharing to create conditional access to data
::: Analyze suitability of FLS, page layouts, and record types to satisfy business requirements Implementing Business Processes
::: Use the vlookup, regex, ischanged, isnew, and priorvalue functions to build business processes
::: Use validation rules to enforce conditional required behavior
::: Use functions to enforce data format and data consistency
::: Implement multistep approval workflows and escalations to automate business processes
::: Create parallel approval workflows and workflow approvals with dynamic approval routing
::: Use outbound messages as part of an approval workflow
::: Establish approval workflow criteria with crossobject formulas
::: Set up field history tracking to audit processes
::: Learn techniques to prevent or record data changes Managing Data
::: Learn when and how to use upsert
::: Use data management tools and the capabilities of API-based tools
::: Configure the Data Loader via command line

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 214
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

::: Encrypt passwords using encrypt.bat


::: Use the Data Loader to create mapping files and to upsert data Visualforce Pages
::: Learn about the capabilities of the Visualforce framework
::: Incorporate Visualforce pages into Salesforce
::: Construct expression bindings and incorporate Salesforce into Visualforce pages with Visualforce tags
::: Use Visualforce tags to create page layouts, input forms, output tables, custom components, and more
::: Create partial page refreshes on JavaScript events
::: Learn about the functionality that comes with Visualforce standard controllers
::: Find out when Apex is required for creating custom controllers or extensions

Apex & Visualforce Controllers (DEV501)


Apex
::: Learn about Apex features compared to other programming languages
::: Learn about use cases for which Apex is a good solution
::: Learn about Apex access modifiers
::: Learn about available Apex object types
::: Learn about types of collections
::: Learn the syntax for including SOQL queries within Apex
::: Write SOQL for loops to handle bulk data
::: Learn about the two types of DML statements
::: Use limit statements
::: Learn about the Save execution order and when “before” and “after” Apex triggers fire
::: Learn about the types of governor limits and contexts
::: Code Apex triggers to handle bulk data
::: Create a unit test for a previous class, using assertion methods, and run a test
::: Write a Web services class
::: Consume an external WSDL and access it through Apex
::: Learn the arguments to send an email from Apex
::: Create a Salesforce email domain and code a class to consume email Visualforce Controllers
::: Explore the functionality of each Visualforce standard controller
::: Code custom controllers and extensions
::: Use testing, debugging, and deploying controllers capabilities
::: Learn the basics of testing controllers vs. regular Apex classes

Force.com Integrations (DEV502)


Topic Objective
Day 1 Topics • Force.com & the Force.com developer network
• Integration services
• Mashups, including custom links, Web tabs, & cloud toolkits
• Native desktop connectors
• Custom-built solutions, including the API and SOAP, mass batch data loading, near real-time integration, & Force.com SOA & callouts
• The Force.com data loader, the free prebuilt API client, & information about when to use the data loader vs. build/buy
• Middleware/AppExchange solutions, including advantages & connectivity via the Web services API
• Call center integration & multichannel integration (e.g., chat, email)
• Single sign-on integration & architecture options
• Web site integration with Force.com sites, portals, and salesforce.com’s ideas
Day 2 Topics • Characteristics of the Web services API, including SOAP, WSDL, SSL standards, security models, & a typical API client architecture
• Nouns, verbs, & standards
• SOQL & SOSL
• Development steps, including creating a project, generating proxy classes, & custom development
• Working within the API constraints
• Debugging & testing
• Working with the partner WSDL
• Additional API techniques such as multi-threading, concurrent sessions, & the wrapper class
• Working with the bulk API for mass data loading
• Using the Force.com data loader as an integration client & including the data loader in architecture
• Introduction to Force.com code & custom Force.com Web services
Day 3 Topics • Force.com SOA, including accessing external Web services, generating from the
WSDL button, & remote Force.com site settings
• Force.com code callouts
• Creating a salesforce.com email inbox
• Declarative integration features, such as outbound messaging & Salesforce to Salesforce

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 215
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

• Sites, portals, & ideas integration, including an introduction to Force.com pages & a Force.com sites overview The course culminates in a design workshop, group
discussion,

IIntroduction to Object-Oriented Programming with Force.com Code (Apex) (DEV531)


Topic Objective
Introduction to Force.com Code • Overview, including Force.com code in the salesforce.com stack, environment
requirements, usage scenarios, the development lifecycle, execution methods,
and salesforce.com objects & fields
• An introduction to object-oriented programming, classes, & objects
• Installation & development using the Force.com IDE
Force.com Code Building Blocks • Classes, variables & methods, & data objects
• Data objects & relationships between objects
• Force.com code variables, data types, & expressions
• Best practices for formatting, commenting, & naming conventions
Force.com Code Class Construction • Classes and objects, including passing & returning variables, encapsulation,
conditions & logic flow control, loops, & exception handling
Force.com Triggers & Data • Introduction to Force.com triggers, including when to use a trigger, order of
execution, creation & development considerations, & governors & limitations
• An introduction to querying data with SOQL and SOSL
• Data Manipulation Language (DML)
Testing, Debugging, & Deployment • Debugging scenarios, methods, & tools
• Test classes, unit testing, testing requirements & strategies, &
considerations & best practices
• IDE testing & an overview of Salesforce CRM UI testing
• Deployment checklist & preparation steps
• Force.com IDE deployment

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 216
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Sales Force - Sample Resume


Alekhya.B
House No. XXX , Miyapur, Hyderabad -500049 (A.P)
Ph : +919XXXXXXXX , Email : xxxxxxxx@gmail.com

Objective
To obtain a challenging position in the industry by using my technical and problem solving ability and by
updating knowledge in the design and development of software systems.

Carrer Summary

● Having * years of IT experience with * years of experience on Salesforce.com CRM.


● Possess comprehensive understanding on SFDC full life cycle and Waterfall model.
● Administration, Configuration, Implementation and support experience on Salesforce.com CRM.
● Experience working with Force.com IDE in design and development of Custom Application for
Complex Business Processes in both Sales and Service Cloud Modules.
● Possess comprehensive understanding of CRM business processes like Campaign Management, Lead
Management, Account Management, Case Management, Quote, Forecasting, and Call Center.
● Extensive knowledge of Salesforce.com implementation cycle in Sales, Marketing, Service and support
modules.
● Skilled in customizing standard objects and develop Custom objects, Page-Layouts, and Record-types to
distinguish between various requirements.
● Knowledge in Salesforce.com SFA, Force.com Apex Classes, and Apex triggers, Designing Visual
force Pages, Components and Controllers considering the Governor Limits.
● Good Understanding and Knowledge in designing Report, Dashboards, and Analytic Snapshots.
● Experience in implementing the Master-Detail, Look-up, Many-to-many and Hierarchical relationships
and Automate the business Process using Workflow rules, Approval Process, Auto-Response Rules and
Escalation Rules.
● Expertise in controlling the data access across the Application using Field-level security and
Organization-wide Defaults, creating Profiles, Queues, Setting up Role Hierarchy, Company profile and

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 217
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

writing the Sharing Rules as per the Requirements.


● Experience in validating the data using Validation Rules, and Creating Debug logs for users.
● Hands-on experience in using Apex Explorer and other Third party application in App exchange such as
Data Loader, Outlook Connect, Informatica Data loader.
● Having good Knowledge on Knowledge Management, Translation workbench, and Content
Management.
● A very good team player with the ability to work independently, a competent, co-operative and result
oriented IT consultant possessing excellent interpersonal, written and oral communicational skills

Education
Course Branch University/Board Year of Passing Pass %

B-Tech CSE JNTU Hyderabad xxxx xx%

Intermediate MPC Board of intermediate xxxx xx%

10th - SSC xxxx xx%

Technical Skillset
• Salesforce Technologies Apex Triggers, Apex Classes, SOQL, SOSL, Visual Force
• Pages, Apex Web Services, Force.com Eclipse IDE
• Plug-in, Workflow & Approvals, Dashboards,
• Reports, Analytic Snapshots, Custom Objects.
• Languages JAVA, Apex.
• Web Technologies HTML, CSS, JavaScript.
• Operating Systems Windows XP/Vista/7.

Work Experience (2.1 Years)


Asort Technologies - Bangalore, March 2012 –Till Date
Salesforce.com Consultant
Order Management System’ is a web portal based primary distribution management tool for Asort
employees; it allows investors and customers to interact with Asort. It is a CRM application built on
Salesforce.com CRM solution and provides a single place to manage and view everything about the clients
like its Account detail, contact information, pending orders, cases in pipeline.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 218
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Responsibilities
● Working closely with Salesforce Programing team to drive successful implementations of new projects,
adoption data quality and best practices of use.
● Assist in the configuration and maintenance of "Sandbox" environments to facilitate success development
and QA testing of new on-demand features and functionality.
● Created separate views for different users for the tabs like accounts, opportunities etc.
● Created different folders to store the reports of different groups and categories.
● Designed, and deployed Custom tabs, Entity-Relationship data model, Auto-Response Rules, Components,
VisualForce Pages to suit to the needs of the application.
● Used Apex Explorer and Apex Data Loader to Manage and Query the data.
● Created customized page layouts and record-types for Opportunity, Contacts, and Accounts to distinguish
between different Processes.
● Involved in Design and development of Workflow rules, triggers, and validation rules, Profiles, Custom
Buttons, Custom links, Custom Pages, Extended controllers, and Apex classes to drive the functionality.
● Created Email templates, approval processes, Auto response Rules and Multi-Step Approval Processes as
per the requirements and defined approval actions on them to automate the processes.
● Deployed the code from Sandbox to Production and was part of release activities and UAT.

BMC Software, Bangalore India Aug 2011 – March 2012


Salesforce Developer

BMC Software, Inc. is a multinational corporation specializing in Business Service Management software.
BMC develops markets and sells software used for multiple functions; including IT service management,
data center automation, performance management and cloud computing management.

Responsibilities
● Interacted with various team members to analyze the gathered requirements, planned and prioritized
the design and implementation of Functionality requested by the Stakeholders.
● Worked with various salesforce.com objects like Accounts, Contacts, Leads, Opportunities, Reports, and
Dashboards.
● Developed Apex Classes, Controller Classes and Apex Triggers for various functional needs in the
application and built
● Created page layouts, search layouts to organize fields, custom links, related lists, and other components
on edit pages, Visual Force Pages and Controllers.
● Created and used Email templates in HTML and Visualforce.
● Implemented field level security along with page layouts to manage access to certain fields.
● Developed and deployed workflows and approval processes for opportunities and products/ assets
management.
● Involved in pre-deployment activities and was part of regressing and UAT.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 219
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Surya Technologies, Hyderabad Sept 2010 - July 2011


Java Developer
Responsibilities:
● Serve as consultant in small development department.
● Responsible for enhancements and general support requests on a custom built Executive Information
System.
● Review use case and design documents.
● Perform technical analysis/design.
● Create test case documents.
● Develop test and debug Java code and JSP pages.
● Developing dynamic web pages using HTML, CSS and JavaScript and testing them.
● Perform technical analysis/design.
● Create detailed technical specifications from functional specifications.
● Used Rational Rose and Microsoft Visio, UML tools for creating sequence class and class diagrams.

Achievements
Academics
 Awarded as ‘Best Student of the Year’ during school days
 Volunteering and participation University, National level Fest
 1st pize (2 Times ) in Paper Presentation at different University, National level Fest
Extra-Curricular Activities
 Gold Medal in Elocution and Debate at Zonal, Regional and State level Inter School , College competitions.
 Gold Medal in Quiz Competition
 Awarded with 2ND place State Level Classical dance competition.
 First place in state level classical dance competition.
 Participated on Reality TV game show for one of Leading Telugu Channel.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 220
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Projects
01. Mini Project - Admin (Find below)
02. Dummy Project – Admin & Development (End of Class –
Contact Trainer)
03. Real Time Project – Admin & Development (End of Class –
Contact Trainer)

Sales Force Administration Project - Mini

Project Title : Sales Automation System 2.0


Client : Top Innovation
Modules Covered: SObjects, Layouts and Record Types, Workflows, Approval Process,
Relationships, Security Systems (Roles, Profiles, OWD, Rules), Classes , Triggers, DML’s.
Client Introduction : Benny Lee founded Top Innovations, Inc. in 1987. Prior to that time Mr.
Lee owned and operated a successful trading company in Taiwan. Mr. Lee's trading company has
been involved in many successful ventures over the past twenty years. Projects such as the "Ginsu
Knife", that became one of the most recognized brand names in the U.S.A., the "Handy Stitch" by
Singer, and many other popular products have been handled by Mr. Lee's trading company. Today,
Top Innovations, Inc. under Mr. Lee's leadership is involved in expanding its line of fabric steamers
and steam cleaners from its new 47,000 square foot facility in Kansas City, Missouri. Top is
constantly working on a number of exciting new consumer products to make life simpler and
enhance consumer/ Business productivity at home and commercial units.
Organization Chart :

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 221
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

CEO

Director Finance Director Mktg Director Sales Director Services

Manager Banking Manager Consumer Manager Industrial Manager Product & Contact Center
Manager Finance Brand Manager
and Industrial Sales Sales SME Manager
Finance

Exe1

Team Manager Team Manager


Accountant Accountant Brand Team Advt Team Team Manager Team Manager Exe1
Team 1 Team 2
Executive Executive Team 1 Team 2

Executive Exe1 Exe1 Exe1


Exe1 Exe1
Executive
Exe1
Executive Exe1 Exe1 Exe1
Exe1 Exe1
Executive
Exe1 Exe1
Executive Exe1 Exe1

Exe1
Exe1 Exe1

Forms:
01. Customer (Indv and Companies)
Customer
Field Values Requirement Sections Conditions/Rules Layouts
General
Account Number Autogen Yes Info 8Digit 1 &2
Mr., Mrs.,
Miss, DR., General
Salutation Prof. No Info 1
General From Companies
First Name Yes Info <> Customer 1 &2
General
Last Name Yes Info 1 &2
General
Gender Male, Female No Info 1
General Lookup from
Company Name No Info Companies 1 &2
Manager,
Decision
Maker,
Director,
Purchase General
Positions Officer, No Info 1

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 222
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Active,
Inactive, General
Status Closed Yes Info 1 &2
Contact
Mobile Phone No Info 1
Contact
Desk Phone No Info 2
Contact
Office Phone No Info 2 Phones 2
Contact
Email No Info 1 &2
Company
Company Website No info 2
Company
Industry Type List No info 2
Company
Company Size No info 2
Auto Calculation -
If 0-10: HB, 11-25
:MB, 26-100:HB,
Company 101-300:CB,
Stage Yes info >300:ENT 2
Company
Sic Code No info 2
Company
Head Office Location No info 2
Number of Branch Company
Office No info 2
Company
Emp Size No info 2
Private,
Public, Company
Type Proprietorship No info 2
Personal
Aniversity No Info 1
Personal
Birthday No Info 1
Education Personal
Qualification No Info 1
Calculation Personal
Age From DOB No Info 1
Address Repeat For
Street 1 No Info Company Address 1 &2

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 223
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Address Repeat For


Street 2 No Info Company Address 1 &2
Address Repeat For
State No Info Company Address 1 &2
Address Repeat For
Zip No Info Company Address 1 &2
Address Repeat For
Country No Info Company Address 1 &2

02. Deals:
Deal
Field Values Requirement Sections Conditions/Rules Layouts
General 10 Digit, Starting with
Deal Number Autogen Yes Info Type 1
General
Company Name Yes Info 1

General From Companies <>


First Name Yes Info Customer 1
General From Companies <>
Last Name Yes Info Customer 1

Manager,
Decision
Maker,
Director,
Purchase General
Positions Officer, No Info 1
Active,
Inactive, General
Deal Status Closed Yes Info 1
From Companies <>
Deal Stages Customer 1
Contact From Companies <>
Mobile Phone No Info Customer 1
Contact From Companies <>
Desk Phone No Info Customer 1
Contact From Companies <>
Office Phone No Info Customer 1
Contact From Companies <>
Email No Info Customer 1

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 224
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Company From Companies <>


Company Website No info Customer 1
Company From Companies <>
Industry Type List No info Customer 1
Company From Companies <>
Company Size No info Customer 1
Auto Calculation - If 0-10:
HB, 11-25 :MB, 26-
Company 100:HB, 101-300:CB,
Stage Yes info >300:ENT 1
Company
Sic Code No info 1
Company
Head Office Location No info 1
Number of Branch Company
Office No info 1
Company
Emp Size No info 1
Solution,
Indvd
Product, Company
Deal Type Bulk No info 1
Company From Companies <>
State Yes info Customer 1
Financial
Expected Rev Yes Info 1
Financial
Pipe Line Rev Yes Info Auto Calculation 1
Financial
Deal Product Yes Info 1
Financial
Product Qtty Yes Info 1
Financial
Discount % No Info 1
Total Amount after Yes id D
Discount exist Auto Calculation 1

03. Cases (Generic to product specific )


05: Product page with product description . Refer to http://www.topinnovations.com/products/

Layouts (Custom Pages) :

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 225
Cloud Computing & Sales Force v4.1 – By RUPOM CHAKRABORTY

Approval Process:
01. Deal between $2500 to $5000 needs account officer approval . Deal between $5000 to $
10000 needs Finance Manager approval and deal greater than 10000 need director approval.
02. Discount greater than 5% needs director approval. By pass Manager.

Work flow:
01. Automatic Sending of Welcome email to Customer on new Company/Individuals.
02. Creation of Initial Phone discussion and assigned to outbound queue.
03. Automatic routing of escalation to escalation queue.

Reports
01. Sales pipeline reports
02. Un attended customer by State and Product Category.
03. Un attended deal greater than 3 Days.
04. Sales performance Dashboard by Team/ Agents
05. Service closure rate report.

Templates:
01. Creation of Customer Print Page with overall customer details of deal for sending to
customer.
02. Company Letterhead with Signatures.
03. Data Upload Templates (Offline)

Business Rules :
01. Auto creation of initial deal with open status with 3 days due date.
02. Auto number generations.
03. Daily auto run reports EOD.
04. Calculation as per Forms.
05. Higher authority can over write previous.
06. Deal greater than $10000 and Sales stage is greater than 50%. Email to Director of sales and
SME.
07. Deal greater than $ 5000 ,SME access.

Data Mgt:
01. Legacy data transfer.

Rupom Chakraborty - Capital Info Solutions


Shyamala Plaza, Behind Mythrivanam, Amerpet, Hyderabad, Telangana State, INDIA. Ph: 8686864286
Page 226

You might also like