Cloud computing has made significant changes to the IT/software development industry. Cloud platforms are one of the important components of cloud computing. Cloud platforms allow developers to develop apps and run them on the Cloud, including platforms to build on-demand applications and platforms as a service (PaaS). Salesforce.com has introduced the first on-demand platform called Force.com.
This chapter introduces the Force.com platform and explains designing and developing applications on the Force.com platform. The sample application scenario and Entity Relationship Diagram (ERD) will be introduced at the end of this chapter. This chapter covers the following topics:
Introduction to the Force.com platform
Designing and developing applications on the Force.com platform
Identifying building blocks of the Force.com platform
The sample application
Salesforce.com established the company as a Customer Relationship Management (CRM) product vender in 1999. The Force.com platform, which is known as Salesforce.com's platform as a service (PaaS) product, was launched in 2007. Force.com is a cloud computing platform that allows for developers to quickly build, share, and run custom business applications over the Internet. When we are developing applications on the Force.com platform, we don't need any additional hardware, additional software, and configuration and maintenance (database and hardware) efforts. The Force.com platform provides three default application categories, which include applications of Salesforce.com CRM. The main categories are as follows;
Sales cloud: This is for the automated Sales processes of an organization. For example, from campaign management to lead capture and account to quote management, you can do everything related to Sales here. Sales cloud can be used for marketing, leads, opportunities, and maintaining new customers (Accounts and Contacts).
The Force.com platform runs on Salesforce.com's infrastructures with the main architecture called multitenant architecture. For more details about multitenancy, read the Key features of Force.com platform subsection. The multitenant architecture allows us to build custom applications without purchasing hardware and software licenses and without having to worry about database maintenance. It provides a trusted, configurable and customizable, upgradable, able to integrate, and a secure platform to build our custom applications on.
In traditional software development, we need to manage additional software and hardware, software licenses, networks, database configurations, and maintenance by ourselves. However, the Force.com platform provides these additional features in their cloud computing model. We need to pay only for the things we use, not for all the hardware and software. That's because we get the Force.com platform as a service.
Supply the core services of Database access
Form builder (build complete and standard UIs)
Supply Containers for logic
Supply Containers for presentation
Logic and presentation as a service (Apex and Visualforce for custom developments)
Need to use other software to create our app
Fully functional reporting and analytical tools
Additional components to run the data center
All of this will end up with additional expenditure
Workflow and approvals
Full support for the integrations with existing systems
Full support for mobile devices
Multitenancy is the major technology of the Force.com cloud platform. It is used to share the IT resources in a secure and cost-effective way. Let's consider a real-world example to understand the multitenancy. Let's think about a luxury apartment complex with some facilities such as a playground, a swimming pool, and a gymnasium. This apartment complex has multiple owners. Everyone owns a separate apartment and every owner uses the shared playground, the shared swimming pool, and the shared gymnasium. These facilities are equal to a single, shared stack of hardware and software. The apartment is equal to the instance of a single client (a tenant). Therefore, a client has their own apartment with shared facilities and privacy.
Application providers can gather some information (such as errors and performance issues) of the application, which will be helpful to make further enhancements
An error can be incurred from a particular tenant, but the solutions will be received by all the users who use the application
In traditional software development projects, we have to build or integrate various additional support applications such as login, validations, e-mail functions, reporting, UI, testing, and integrations. You had to repeatedly build these kinds of additional support applications in different projects. The Force.com platform provides the majority of support applications, which are most commonly needed in developing today's business application. For example, the Force.com platform has various features to automate your business process such as reporting, workflow and approvals, e-mail, user authentication, and integrations. These services are common to many software projects. Therefore, we can build applications with more functionality and within a short time period.
With multitenancy, we get secure, fast, reliable, customizable, and upgradable applications. When it comes to custom extensions by multiple tenants, we need to track and keep tenant-specific customizations without affecting the core application. The metadata-driven architecture takes care of that. After multitenancy, metadata-driven architecture is the second most important architecture in the Force.com platform. All the configuration, customization, and coding in the Force.com platform are defined and available as XML. It can be extracted and imported via a set of web services. Simply, metadata is data about data. The metadata-driven model provides the following advantages:
Complex applications can be created by only using point-click developments (without any coding).
A developer can build the application with the end user experience but the elements of the application are automatically translated to the metadata at creation time.
Metadata provides a speedy development.
Customization and extensions can be done without affecting the end user.
Metadata can be used to construct an identical environment to use in another organization.
Metadata can be used for testing and troubleshooting by comparing multiple environments.
The preceding figure shows the metadata-driven architecture of Force.com. It creates the separation between the runtime engine, the application data, and metadata. The polymorphic application includes database tables, relationships, UI elements, pages, classes, and so on.
Controller: This defines the business logic. The rules and actions which manipulate the data control the view. In Force.com, apex classes, triggers, workflows, approvals, and validation rules are under this category.
Apex, the world's first on-demand language is considered as the programming language of the Force.com platform. Apex is object oriented and the syntax is similar to Java and C#. It allows developers to build the logic with the interaction of existing platform features. According to the MVC architecture, Apex falls into the controller because it is used to write the controller classes and triggers on the Force.com platform. Apex can be used to:
Visualforce is an implementation of MVC architecture. In the Force.com platform, we can develop Force.com applications with custom objects and standard objects. Every object has a standard user interface with one or more page layouts. But we cannot use standard page layouts for complex requirements. Here, Visualforce comes into play.
Salesforce Object Query Language (SOQL) allows us to fetch data from Saleforce objects. SOQL syntax is similar to SQL but simpler. For example, SOQL has the SELECT keyword but doesn't contain the INSERT or UPDATE keywords. It is different from SQL as SOQL doesn't have the JOIN keyword. SOQL can be used in Apex code and it provides a powerful feature to manipulate and process data in Apex code.
Salesforce Object Search Language (SOSL) allows us to search your organization's data from Salesforce objects by specifying a text expression, scope of field to search, list of objects and fields to retrieve, and conditions to select rows in the source objects.
SOQL is used to fetch data from a single object and SOSL is used to fetch data from multiple objects. More about SOSL and SOQL will be discussed in Chapter 7, Custom Coding with Apex.
The Force.com platform provides the facility to integrate with existing applications. There are various advantages of integrating, such as including external systems into our processes, syncing data from multiple sources, and accessing data in other systems. Using an open Simple Object Access Protocol (SOAP) web service, the Force.com API provides access to all the data stored in the application. There are integration benefits as follows:
By using Force.com technologies, it takes less time to integrate than traditional integrations
The Force.com platform-based API provides direct and low-level access to Salesforce application data and metadata
There are many options to choose integration technologies and solutions that fit into their existing system
Proven platform and integration
Data from selected organizations can be exposed to the public through your own domain URL
There are no integration issues because Force.com sites are hosted on Salesforce servers
It can be built using Visualforce pages
According to the requirement, you can enable or disable the user registration
With the preceding features, you can build different kinds of applications. But how can you publish and distribute these applications? AppExchange will do it for you. AppExchange is the place to submit your developed applications, which can be directly installed in the client's organization.
We don't need to buy, install, maintain, and configure hardware and software.
We can start customizations as soon as we buy the organization and user license.
We can rapidly build and customize the applications on the Force.com platform.
The Force.com platform has a simplified development model because it uses multitenant and metadata-driven architecture.
It has the feature of instant scalability.
Quarterly upgrades of Salesforce.com do not require any maintenance from the user.
We can use or build multiple applications on a single platform. This is dependent on which Salesforce edition you are using. In Salesforce, the limitations change from edition to edition.
The Force.com platform is more secure and reliable. To learn more about security and trust visit http://trust.salesforce.com/.
Before you start development on the Force.com platform, you have to do some ground work and have to learn about the data orientation of the Force.com platform, suitability of the application for the Force.com platform, the nature of the data underlying that application, and design the application for the Force.com application.
The Force.com platform provides the development environments, tools, resources, and documentation, which can be used to develop applications. The Force.com tools will be described in Appendix A, Force.com tools. When we talk about development environments, free developer edition (DE) environment is the best option to develop with the latest technologies such as the Apex programming language, Visualforce markup language, and web services API.
DE is free, and you can use it for learning purposes, although it comes with certain limitations.
Click on Signup.
Then, you will get the following page and fill all the fields in the form.
An e-mail will be received including the link to specify your login credentials
When we design and build an application on the Force.com platform, we need to be aware of the data that we are going to process underneath the application. Good data design and good development practices can produce flexible and efficient applications.
We cannot use the Force.com platform for any kind of application development. Therefore, we need to understand the apps that are better suited for the Force.com platform. There are four types of applications that are required to automate an enterprise process, which are as follows:
Data-Centric Apps: Data-centric applications are the ones that have powerful databases. They are based on the structure and consistency data such as in database or XML files. They are centered on a database and with data-centric apps it is easy to control access and manage data, which are centered to the database. The Force.com platform is data-centric by its nature and it is a perfect platform to build and host data-centric apps.
Process-Centric Apps: A process-centric app is based on automating the business process in the organization and multiple users can be involved in the process. The Force.com platform has many features that align with the features of process-centric applications such as the approval process, the workflow, and security and sharing models.
Content-Centric Apps: These applications are intensely increasing the storage needs of on-demand performance. These kinds of applications have main functionalities such as version controlling, content management, and sharing.
Data and process-centric apps are the most suitable application types for the Force.com platform. The following two figures explain to us how the data-centric and process-centric apps are the most suitable apps for the Force.com platform:
When we develop a system on the Force.com platform, we need to consider some facts about the design phase. As in traditional software development, identifying your stakeholders and business partners is the first thing you need to do. Then, you need to capture the business requirement from your stakeholders. By analyzing the captured requirement, you can identify the users of the applications and the security model of the application. The security model is the most important part of designing a Force.com application.
Declarative Development: This development can be done using point and click with zero coding. We can do declarative development via the browser. The declarative customizations require an understanding of the Force.com platform overview, but no coding knowledge. The developments and deployments can be rapidly done using the declarative development method.
Programmatic Development: Programmatic developments require coding skills and allow developments to extend beyond the declarative capabilities. For example, if we need to create a page with a wizard, we cannot fulfill that requirement with declarative development. We need to use programmatic development, such as Apex and Visualforce.
The following screenshot shows the Force.com development model. It illustrates the deviation development methods with the skills of the developer.
Most complete and robust solutions actually use a combination of declarative and programmatic solutions. Developers should understand how to develop using both declarative and programmatic features. The following table shows the advantages of declarative and programmatic customizations:
Ease of development (more visual and quicker to do)
Can extend the capabilities of an application beyond standard functionalities
Ease of upgrade
More control and flexibility over the application
Ease of maintenance
Every application has some key components that are considered as the building blocks of the particular application. These building blocks define the application. An application of the Force.com platform also has three core components, which are as follows:
Objects: The object is the main component of building the application on the Force.com platform. The Force.com platform doesn't allow accessing the database of a particular application. But we can create an object instead of a database table. Therefore, an object and object field will be respectively mapped to a database table and table columns of the particular table. There are two types of objects: standard objects and custom objects. Standard objects are used in CRM applications and they are created by Salesforce.com. The custom objects are created by developers according to their requirements. This book is focused on Force.com development. Therefore, you will work more with custom objects, and according to the requirements, you will work with standard objects. For further details, refer to Chapter 2, Building the Data Model.
Tabs: These are the views of objects. We need to declare tabs if we want to insert data records in them. There are standard tabs that are created by Salesforce.com and custom tabs that can be created by developers. There are 3 types of custom tabs:
Custom object tabs: On Force.com, when we create a custom object, a set of user interfaces are generated to add, edit, and view particular object records. These standard user interfaces can be bound to a custom object tab. While creating an object, it is asked at the bottom to launch the tab wizard, opening of which redirects us to the next page where we declare the tab of an object.
Visualforce tabs: These types of tabs are used to bind and display a Visualforce page. More details about custom tabs will be described in Chapter 3, Building the User Interface.
Application: An application is a group of tabs that work as a unit to provide functionality. A Saleforce.com organization can have multiple applications. The users can switch between apps in an organization. Then we need to have a method to define the logical boundary of the app. The number of custom applications in a particular organization depends on the Salesforce edition of the organization.
More details about the custom app will be described in Chapter 3, Building the User Interface.
Let's introduce the leave management application called eLeaveForce. In this application, an employee can request a particular type of leave and his/her manager can approve the leave. We will maintain the leave types and leave categories as reference data (user defined data). A holiday calendar will be maintained for this leave management application. You can use this application to learn about different elements and features of the Force.com platform.
The following is the E-R diagram of the eLeaveForce application, which we will create on the Force.com platform:
In this section, you will capture an idea about the leave management application and the design of the eLeaveForce application. Later, you will learn about the Force.com platform in depth by using this sample application.
There are six custom objects for our leave management application. These six custom objects are used to track the data of the leave management app. They are as follows:
Leave (main leave object)
According to the requirement, these objects are connected with relationships as illustrated in the E-R diagram. More details about custom objects and relationships will be described in Chapter 2, Building the Data Model.
When we define the security model of the application, we need to consider the built-in security features of the Force.com platform. More details about sharing and security models will be described in Chapter 4, Designing Apps for Multiple Users and Protecting Data.
Our leave management app has a few approval processes, such as getting the approval for the particular leave. Approval processes are considered in our design and will be implemented using the in-built workflow and approval processes. More details about workflow and approval processes will be described in Chapter 5, Implementing Business Processes.
We will use Visualforce pages and Apex to accomplish the requirements that can be fulfilled beyond the declarative developments. For example, a graphical view of the current status of the leave process will be displayed on a Visualforce page. More details about Apex and Visualforce will be described in Chapter 7, Custom Coding with Apex and Chapter 8, Building Custom Pages with Visualforce.
In this chapter, we became familiar with the Force.com platform by examining its key features and advantages. You have learned the design considerations of an application on the Force.com platform and development methods of the Force.com platform. We discussed the building blocks of a Force.com application. We also captured the scenario and the E-R diagram of the sample application, which is going to continue in the next chapter.