This chapter will introduce you to the Force.com platform. We will understand the life cycle of an application build using Force.com. We will define a multi-tenant architecture and understand how it will impact the data of organizations stored on the cloud. And finally, we will build our first application on Force.com.
We will cover the following topics in this chapter:
The multi-tenant architecture of Force.com
Understanding the Force.com platform
Application development on the Force.com platform
Discussing the maintenance and releases schedule by Salesforce.com
Types of Force.com applications
Discussing when to use point-and-click customization and when to use code
Discussing Salesforce.com IDs
Developer resources
So, let's get started and step into the cloud.
Force.com is a cloud computing platform used to build enterprise applications. The end user does not have to worry about networks, hardware, software licenses, or any other things. The data saved is completely secure in the cloud.
The following features of Force.com make it a 100 percent cloud-based system:
The multi-tenant architecture: The multi-tenant architecture is a way of serving multiple clients on the single software instance. Each client gets their own full version of the software configuration and data. They cannot utilize the other instance resources. The software is virtually partitioned into different instances. The basic structure of the multi-tenant architecture is shown in the following figure:
Just like how tenants in a single building share the resources of electricity and water, in the multi-tenant system tenants share common resources and databases.
In a multi-tenant system, such as Salesforce.com, different organizations use the same shared database system that is separated by a secure virtual partition. Special programs keep the data separated and make sure that no single organization monopolizes the resources.
Automatic upgrades: In a cloud computing system, all the new updates are automatically released to its subscribers. Any developments or customizations made during the previous version are automatically updated to the latest version without any manual modification to the code. This results in all instances of Salesforce staying up to date and on the same version.
Subscription model: Force.com is distributed under the subscription model. The user can purchase a few licenses and build the system. After the system is up and successful, further user licenses can be purchased from Salesforce. This model ensures that there are no large startup fees and we pay as we go, which adds fixed, predictable costs in the future.
The subscription model can be visualized like the electricity distribution system. We pay for whatever electricity we use and not the complete generator and the infrastructure.
Scalability: The multi-tenant kernel is already tested and runs for many users simultaneously. If the organization is growing, there is always room for scaling the application with new users without worrying about load balancing and data limitation. Force.com provides data storage on a per-user basis, which means that the data storage increases with the number of users added to the organization.
Upgrades and maintenance: Force.com releases three updated versions every year. The new releases consist of feature updates to Salesforce.com and the Force.com platform with selected top ideas from IdeaExchange. IdeaExchange is the community of Salesforce users where the users submit ideas and the community votes for them. The most popular ideas are considered by Salesforce in their next release.
All instances hosted on the servers are upgraded with no additional cost. The Salesforce maintenance outage during a major release is only 5 minutes.
The sandboxes are upgraded early so there can be testing for compatibility with the new release. The new releases are backward-compatible with previous releases, thus the old code will work with new versions. The upgrades are taken care of by Force.com and the end user gets the latest-version running application.
In the earlier edition of this book, we discussed the Force.com platform in detail. In the last couple of years, Salesforce has introduced a new Salesforce1 platform. It encompasses all the existing features of the Force.com platform but also includes the new powerful tools for mobile development. The new Salesforce1 platform is built mobile-first and all the existing features of cloud development are automatically available for mobiles. From Winter 16, Salesforce has also introduced the lighting experience. The lighting experience is another extension to the existing platform. It provides a brand new set of design and development library that let developers build applications that work on mobiles as well as the Web.
Let's take a detailed look at the services that form the platform offered by Force.com. The following section provides us with an overview of the Force.com platform.
Force.com is the world's first cloud application development platform where end users can build, share, and run an application directly on the cloud. While most cloud computing systems provide the ability to deploy the code from the local machine, Force.com lets us directly write the code in the cloud.
The Force.com platform runs in a hosted multi-tenant environment, which gives the end users freedom to build their custom application without hardware purchases, database maintenance, and maintaining a software license. Salesforce.com provides the following main products:
Sales force Automation, Sales Cloud
Service and Support Center, Service Cloud
The Exact Target Marketing Cloud
Collaboration Cloud, Chatter
The following screenshot shows the Force.com platform:

The application built on Force.com is automatically hosted on the cloud platform. It can be used separately (without the standard Sales, Service, and Marketing cloud) or can be used in parallel with the existing Salesforce application.
The users can access the application using a browser from any mobile, computer, tablet, and any of the operating system such as Windows, UNIX, Mac, and so on, giving them complete freedom of location.
For a complete list of supported browsers, visit:
https://help.salesforce.com/apex/HTViewHelpDoc?id=getstart_browser_overview.htm
The most efficient way to build an enterprise application is to clearly separate out the model: the data, the code (the controller), and the UI (the View). By separating the three, we can make sure that each area is handled by an expert. The business logic is separated from the backend database and the frontend user interface.
It is also easy to upgrade a part of the system without disturbing the entire structure. The following diagram illustrates the model-view-controller of Force.com:

We will be looking in detail at each layer in the MVC architecture in subsequent chapters.
Force.com is a hosted multi-tenant service used to build a custom cloud computing application. It is a 100 percent cloud platform where we pay no extra cost for the hardware and network. Any application built on Force.com is directly hosted on the cloud and can be accessed using a simple browser from a computer or a mobile.
The Force.com platform runs on some basic key technologies.
The base of the platform forms a multi-tenant kernel where all users share a common code base and physical infrastructure. The multiple tenants, who are hosted on a shared server, share the resources under governor limits to prevent a single instance monopolizing the resources. The custom code and data are separated by software virtualization and users cannot access each other's code.
The multi-tenant kernel ensures that all the instances are updated to the latest version of the software simultaneously. The updates are applied automatically without any patches or software download.
The multi-tenant architecture is already live for one million users. This helps developers easily scale the applications from one to a million users with little or no modification at all. The following figure illustrates the multi-tenant architecture:

Traditional software systems are hosted on a single-tenant system, usually a client-server-based enterprise application. With the multi-tenant architecture, the end user does not have to worry about the hardware layer or software upgrades and patches. The software system deployed over the Internet can be accessed using a browser from any location possible, even wide ranges of mobile devices.
The multi-tenant architecture also allows the applications to be low-cost, quick to deploy, and open to innovation. Other examples of software using the multi-tenant architecture are webmail systems (such as www.gmail.com and www.yahoo.com) and online storage systems, such as www.dropbox.com, or note-taking applications, such as Evernote, Springpad, and so on.
Force.com is entirely metadata-driven. The metadata is defined in XML and can be extracted and imported. We will look into metadata in detail later in this chapter.
The data and the metadata stored on the Force.com server can be accessed programmatically through the Webservice API. This enables the developers to extend the functionality to virtually any language, operating system, and platform possible.
The web services are based on open web standards, such as SOAP, XML, and JSON REST, and are directly compatible with other technologies, such as .Net, Java, SAP, and Oracle. We can easily integrate the Force.com application with the current business application without rewriting the entire code.
Apex is the world's first on-demand language introduced by Salesforce. It is an object-oriented language very similar to C# or Java. Apex is specially designed to process bulk data for business applications. Apex is used to write the controller in the MVC architecture.
Salesforce Object Query Language (SOQL) gives developers an easy and declarative query language that can fetch and process a large amount of data in an easy, human-readable query language. For those who have used other relational database systems, such as Oracle, SQL Server, and so on, it is similar to SQL but does not support advanced capabilities, such as joins.
Apex and SOQL together give developers powerful tools to manage data and processes for their application, leaving the rest of the overhead on the Force.com platform.
The following screenshot shows the page editor for Visualforce. It is easy to use and splits a page into two parts: the one at the bottom is for development and the other shows the output:

Visualforce is an easy-to-use, yet powerful framework used to create rich user interfaces, thus extending the standard tabs and forms to any kind of interfaces imaginable. Visualforce ultimately renders into HTML, and hence we can use any HTML code alongside the Visualforce markup to create a powerful and rich UI to manage business applications.
Apart from the UI, Visualforce provides very easy and direct access to the server-side data and metadata from Apex. This powerful combination of a rich UI with access to the Salesforce metadata makes Visualforce the ultimate solution to build powerful business applications on Salesforce.
As the Salesforce.com Certified Force.com Developer Certification does not include Apex and Visualforce, we won't be going into Apex and Visualforce in detail.
The Developer Console is an Integrated Development Environment (IDE) for tools to help write code, run tests, and debug the system. The developer console provides an editor for writing code. It also provides a UI to monitor and debug Unit test classes, as shown in the following screenshot:

AppExchange is a directory of applications built on the Force.com platform. Developers can choose to submit their developed applications on AppExchange
. The applications extend the functionality of Force.com beyond CRM with many ready-made business applications available to download and use.

AppExchange is available at http://appexchange.salesforce.com.
Using Force.com sites or site.com, we can build public-facing websites that use the existing Salesforce data and browser technologies, such as HTML, JavaScript, CSS, Angular JS, Bootstrap, and so on. The sites can have an external login for sensitive data or a no-login public portal that can be linked to the corporate website as well.
Site.com helps create websites using drag-and-drop controls. Users with little or no HTML knowledge can build websites using the site.com editor.
Like any other traditional software development process, the Force.com platform offers tools used to define data, business processes, logic, and rich UIs for the business application. Many of these tools are built-in, point-and-click tools simplified for users without any development skills. Any user with no programming knowledge can build applications suitable for their business on Force.com.
The point-and-click tools are easy to use, but they have limitations. To extend the platform beyond these limitations, we use Apex and Visualforce.
Let's now compare the tools used for traditional software development with Force.com:
Java |
Dot Net |
Force.com | |
---|---|---|---|
Building the database |
Oracle, MS-Access, SQL, or any third-party database setup |
Oracle, MS-Access, SQL, or any third-party database setup |
Salesforce metadata (now database.com) |
Connection to the database |
JDBC |
Ado.net |
Salesforce metadata API |
Developing the IDE |
NetBeans, Eclipse, and so on |
Visual Studio |
Online Page Editor and App Setup, Force.com IDE, Maven's Mate, and Aside.io |
Controlled environment for development and testing |
Local servers, remote test servers |
Local servers, remote test servers |
Force.com real-time sandboxes |
Everything on Force.com such as data models, objects, forms, tabs, and workflows are defined by metadata. The definitions or metadata are made in XML and can be extracted and imported. The metadata-driven development also helps users with no prior development experience to build business applications without any need to code. We can define the objects, tabs, and forms in the UI using point-and-click.
All changes made to the metadata in App-Setup
are tracked. Alternatively, developers can customize every part of Salesforce using XML files that control the organization's metadata. The files are downloaded using the Eclipse IDE or Force.com IDE.
To customize metadata on Salesforce UI, go to Setup | Build:

As Force.com Developer Certification is about using point-and-click, we will explore setup details in upcoming chapters.
The metadata API provides easy access to the organization data, business logic, and the user interface. We can modify the metadata in a controlled test organization called the sandbox. Finally, the tested changes can be deployed to a live production environment edition. The production environment is the live environment that is used by the users and contains live data. The production instance does not allow developers to code in them directly; this ensures that only debugged and tested code reaches the live organization.
Force.com provides a built-in online editor that helps edit Visualforce pages in real time. The online editor can be enabled by checking the Development Mode checkbox on the user profile, as shown in the following screenshot:

The online page editor splits the screen into two parts with live code in the bottom half and the final page output in the top half. Force.com also provides an inline editor for editing the Apex code in the browser itself.

Force.com IDE is an IDE built over Eclipse. It provides an easy environment to write code and offline saving. It also comes with a schema browser and a query generator, which helps in generating simple queries (select
statements) by selecting fields and objects. The code is auto-synced with the organization.
Force.com provides a real-time environment to develop, test, and train people in the organization. It is a safe and isolated environment where any changes made will not affect the production data or application. These sandboxes are used to experiment on new features without disturbing live production in the organization. Separating the test and dev
instances also ensures that only the tested and verified code reaches the production organization.

There are four types of sandbox:
Developer sandbox: This environment is specially used to code and test the environment by a single developer. As with the configuration-only sandbox, this also copies the entire customization of the production organization, excluding the data. An added feature of a developer sandbox is that it allows Apex and Visualforce coding.
Developer pro sandbox: Developer pro sandboxes are similar to developer sandboxes but with larger storage. This sandbox is mostly used to handle more developer and quality-assurance tasks. With a larger sandbox, we can store more data and run more efficient tasks.
Partial copy sandbox: This is used as a testing environment. This environment copies the full metadata of the production environment and a subset of production data that can be set using a template.
Full copy sandbox: This copies the entire production organization and all its data records, documents, and attachments. This is usually used to develop and test a new application until it is ready to be shared with users. Full copy sandbox has the same IDs of the records as that of production only when it has been freshly created.
There are some common types of applications that are required to automate an enterprise process. They are as follows:
Content-centric applications: These applications enable organizations to share and version content across different levels. They consist of file sharing systems, versioning systems, and content management systems.
Transaction-centric applications: These applications focus on transactions. They are banking systems, online payment systems, and so on.
Process-centric applications: These applications focus on automating the organization's business process in the organization such as a bug tracking systems, procurement processes, approval processes, and so on. Force.com is suitable for building these kinds of applications.
Data-centric applications: These applications are built around a powerful database. Many of the organizations use spreadsheets for these applications. Some examples include CRM, HRM, and so on. Force.com is suitable for building these kinds of applications.
There are two ways to develop on Force.com: one is to use point-and-click without a single line of coding, called the declarative development. The other way is to develop an application using code, called programmatic development. Let's take a look at the two types of development in detail.
The declarative type of development is done by point-and-click using a browser. We use ready-to-use components and modify their configuration to build applications. We can add new objects, define their standard views, and create input forms with simple point-and-link with no coding knowledge. The declarative framework allows the rapid development and deployment of applications.

The declarative development also follows the MVC architecture in development. The MVC components in the declarative development using Force.com are mentioned in the following table:
Model |
View |
Controller |
---|---|---|
Objects Fields Relationships |
Applications Tabs Page layouts Record types |
Workflow rules Validation rules Assignment rules |
Programmatic development requires prior coding knowledge. This method allows us to extend the Force.com platform beyond declarative capabilities. This method gives us the control and flexibility over the application we build.

The programmatic development also uses the MVC architecture, as shown in the following table:
Model |
View |
Controller |
---|---|---|
Web services API Metadata API External object |
Visualforce pages Visualforce component Sites |
Apex controllers Apex triggers Web service API |
There is no hard and fast rule to help us choose between declarative and programmatic solutions.
Declarative solutions supply ease of development and maintenance. They are automatically upgraded with new releases of Salesforce. They are not subject to governor limits. They are faster and cheaper to build.
However, not all declarative features are capable of building specialized and complex business processes. We cannot build highly customizable user interfaces and click-through them with declarative methods.
You can also prefer to build Salesforce solutions without code first, and then, use the code to extend it beyond its limitations.
The easiest way to get your hands on Salesforce is to log in through a developer account. Developer editions are free, two-user-only accounts that can be used for exercises.
If you already have one, log in to it now or perform the following steps to create one:
Go to http://developer.Force.com.
Click on Join now.
Fill out the form and validate the e-mail address you provided.
In addition to the free developer editions, there are different paid editions that Salesforce offers. The four common types of edition are as follows:
Professional: The professional edition provides limited customization and enhancement opportunities. It is used as a basic CRM with no facility to extend it beyond what is provided out of the box.
Enterprise: This is the most commonly used edition. It provides the ability to extend Salesforce CRM with code.
Unlimited: This is the advanced version of the Enterprise edition is mostly used by large organizations, which require a lot of data space. It provides unlimited customizations.
We can log in to Force.com from any standard web browser or third-party application. As a security measure, Salesforce tries to prevent unauthorized access to your account as it requires verification whenever you log in from a new IP address. The user is authenticated using the username, password, and the IP address of the system. The IP address where account is created is automatically white-listed for the user:

Every time the user logs in from a separate IP address, the application verifies the IP by sending an e-mail to the registered e-mail address in the personal profile. Alternatively, the system administrator can enable access by setting the trusted IP ranges. Users who log in from the white-listed IP ranges are not asked to validate their IP address or the security token.
Tip
The Force.com username is in the format of an e-mail address: xyz@abc.com
; the username is unique across the global organization of Salesforce. If you already have a developer organization with abc@hotmail.com
, you won't be able to create another one in with the same username. You can give a separate username (someone@something.com
) and a valid e-mail (abc@hotmail.com
) in this case.
Use the following steps to whitelist an IP address:
Go to Setup | Administer | Security Controls | Network Access.
Add your IP address to Trusted IP Ranges, as shown in the following screenshot:
If you are within a LAN network of your office, university, and so on, the IP address given by the ipconfig
command in DOS will give you the internal network-specific IP. This IP address is not seen by Force.com; you need the public domain IP address to whitelist the address. To find your public domain IP address, you can visit http://www.whatismyip.com.
Whitelisting the IP address has its own pros and cons; the main benefit is that when logging in via the API, such as with Data Loader or the Force.com IDE, you aren't challenged to provide the security token. The disadvantage is that the security token challenge and IP address verification challenge are not enforced, thus lowering the security threshold of a malicious login attempt.
When you log in to Force.com from a third-party tool, such as the Force.com IDE, Outlook Edition, Data Loader, or the API, you need an additional security token along with a username and password. Every login user gets a security token tied to the password. We need to reset the security token the first time. It is automatically reset whenever the password is changed.
Along with a developer account, http://developer.Force.com provides additional resources for developers. The developer website is your one-stop place to learn more about Salesforce and its features.

It provides the following features:
Additional documentation
Online forums
Code share
All these resources can be accessed free of charge with a single developer account. Additional community blogs and recourses are available in the final chapter of this book.
Note
The first place to get help is from the developer forums available at https://developer.salesforce.com/forums.
If you are on Twitter, additional help can be found using the #AskForce
hashtag with the Salesforce Community. You may also address the Tweet to @sforceNinja
.
One of the coolest new learning resources provided by Salesforce is the Trailhead. It provides free training, tutorials, and interactive learning paths through the basic building blocks of the Salesforce1 platform. We can test our knowledge while earning points and badges to celebrate our achievements.
To begin your learning journey, visit https://developer.salesforce.com/trailhead:

In this chapter, we became familiar with the Force.com platform. We have seen the life cycle of an application build using Force.com. We saw the multi-tenant architecture and how it is different from the web hosting server.
We have a fresh new developer account, and now in further chapters we will be using it to build an application on Force.com.
Answer the following questions:
Q1 Out of the following tasks, which can be done using the Force.com platform? (Select two)
Data warehousing
Creating applications via point and click and not code
Applications can be upgraded without loss of customization
Using a code version control system
Q2 Which of the following statements are true concerning e-mail activation? (Select one)
The e-mail activation feature requires that the user click on an activation link before logging in from a new computer
The e-mail activation feature cannot be disabled
The e-mail activation feature can be disabled by sending a request to Salesforce.com support
The e-mail activation feature can be disabled through the UI
Q3 A security token is required for API access when connecting from an IP address within the list of trusted networks.
True
False
Q4 Out of the following, which applications are suitable for Force.com? (Choose)
Time card application
Word processor
Online auction management
Inventory management
Q5 Which of the following refer to the data model of Salesforce? (Choose 2)
The Force.com API
Force.com metadata API
Sandbox
The Force.com IDE
Q6 What paid Salesforce editions are available?
Enterprise edition
Unlimited edition
Trial edition
Developer edition
Q7 Where are Force.com IDs identical?
Production and full copy sandbox only
Production and dev sandbox only
Two developer orgs
Two sandbox org